parseApps method
Stream<MetaAppConfig>
parseApps(
- File file
)
Implementation
Stream<MetaAppConfig> parseApps(File file) async* {
if (!path.basename(file.path).contains(RegExp(r'[._]app\.dart$'))) {
return;
}
final resolved = await _resolve(file.path, fs);
final classVisitor = AppVisitor();
resolved.libraryElement.accept(classVisitor);
if (!classVisitor.hasApp) {
return;
}
for (final entry in classVisitor.entries) {
final element = entry.element;
yield MetaAppConfig(
className: element.displayName,
importPath: element.librarySource.uri.toString(),
element: element,
constructor: entry.constructor.name,
params: entry.params,
appAnnotation: entry.annotation,
isSecure: entry.isSecure,
annotationsFor: ({
required List<OnMatch> onMatch,
NonMatch? onNonMatch,
}) =>
getAnnotations(
element: element,
onMatch: onMatch,
onNonMatch: onNonMatch,
),
);
}
}