annotationForFile<_Annotation> function

Future<AnnotatedElement> annotationForFile <_Annotation>(
  1. String folder,
  2. String filename
)

The first annotation in a file

_Annotation should reflect the class-level annotation, e.g. @ConnectOfflineFirstWithRest

Implementation

Future<AnnotatedElement> annotationForFile<_Annotation>(String folder, String filename) async {
  assert(_Annotation != null);
  final annotationChecker = TypeChecker.fromRuntime(_Annotation);
  final reader = await _libraryForFolder(folder, filename);
  return reader.annotatedWith(annotationChecker)?.first;
}