Future<String>
generate(Element element, BuildStep buildStep)
Source
@override
Future<String> generate(Element element, BuildStep buildStep) {
var matchingAnnotations =
element.metadata.where((md) => matchAnnotation(T, md)).toList();
if (matchingAnnotations.isEmpty) {
return null;
} else if (matchingAnnotations.length > 1) {
throw 'cannot have more than one matching annotation';
}
var annotationInstance =
instantiateAnnotation(matchingAnnotations.single) as T;
assert(annotationInstance != null);
return generateForAnnotatedElement(element, annotationInstance, buildStep);
}