getFirebaseRulesAnnotation function

Future<DartObject?> getFirebaseRulesAnnotation(
  1. CustomLintResolver resolver
)

Get the first FirebaseRules annotation in a file

Implementation

Future<DartObject?> getFirebaseRulesAnnotation(
  CustomLintResolver resolver,
) async {
  final resolved = await resolver.getResolvedUnitResult();
  for (final element in resolved.libraryElement.topLevelElements) {
    final annotation = firebaseRulesTypeChecker.firstAnnotationOfExact(element);
    if (annotation != null) return annotation;
  }
  return null;
}