firstAnnotationOfExact method
Returns the first constant annotating element that is exactly this type.
Throws UnresolvedAnnotationException on unresolved annotations unless
throwOnUnresolved is explicitly set to false (default is true).
Implementation
DartObject? firstAnnotationOfExact(
Element element, {
bool throwOnUnresolved = true,
}) {
if (element.metadata.isEmpty) {
return null;
}
final results =
annotationsOfExact(element, throwOnUnresolved: throwOnUnresolved);
return results.isEmpty ? null : results.first;
}