# getAnnotations<A> method

List<A> getAnnotations<A>()

Returns a list of annotations of type `A`.

### Example:

    final scopes = def.getAnnotations<Scope>();
    for (final scope in scopes) {
      print(scope.value); // "singleton" or "prototype"
    }

## Implementation

    List<A> getAnnotations<A>() {
      final result = <A>{};
      for (final annotation in annotations) {
        final instance = annotation.getInstance();
        if (instance is A) {
          result.add(instance);
        }
      }

      for (final cls in annotatedClasses) {
        try {
          final instance = cls.newInstance();
          if (instance is A) {
            result.add(instance);
          }
        } catch (e) {
          // ignore
        }
      }

      return result.toList();
    }