isZukeAnnotation function

bool isZukeAnnotation(
  1. Element? element
)

Whether element resolves to an annotation owned by Zuke. This uses the resolved library identity rather than an annotation spelling, so local classes with matching names cannot impersonate the public annotations.

Implementation

bool isZukeAnnotation(Element? element) {
  final libraryUri = element?.library?.firstFragment.source.uri.toString();
  return libraryUri == zukeAnnotationLibrary ||
      (libraryUri?.startsWith('package:zuke_annotations/') ?? false);
}