import 'package:angel_container/angel_container.dart'; final RegExp straySlashes = new RegExp(r'(^/+)|(/+$)'); T matchingAnnotation(List metadata) { for (ReflectedInstance metaDatum in metadata) { if (metaDatum.type.reflectedType == T) { return metaDatum.reflectee as T; } } return null; } T getAnnotation(obj, Reflector reflector) { if (reflector == null) { return null; } else { if (obj is Function) { var methodMirror = reflector.reflectFunction(obj); return matchingAnnotation(methodMirror.annotations); } else { var classMirror = reflector.reflectClass(obj.runtimeType as Type); return matchingAnnotation(classMirror.annotations); } } }