visitClassElement method
void
visitClassElement(
- ClassElement element
)
override
Implementation
@override
void visitClassElement(ClassElement element) {
super.visitClassElement(element);
if (!appChecker.hasAnnotationOf(element)) {
return;
}
if (element.constructors.isEmpty) {
throw Exception('No constructor found in ${element.name}');
}
if (element.constructors.every((e) => e.isPrivate)) {
throw Exception('No public constructor found in ${element.name}');
}
if (element.allSupertypes.every((e) => e.element.name != '$AppConfig')) {
throw Exception('App class must extend `$AppConfig`');
}
final constructor = element.constructors.first;
entries.add(
_AppEntry(
element: element,
constructor: constructor,
params: getParams(constructor),
annotation: AppAnnotation.fromAnnotation(
appChecker.firstAnnotationOf(element)!,
),
isSecure: constructor.superConstructor?.name == 'secure',
),
);
}