methodHasAnnotation method

DartObject? methodHasAnnotation(
  1. Type annotationType,
  2. MethodElement2 element
)

Implementation

DartObject? methodHasAnnotation(Type annotationType, MethodElement2 element) {
  final annotations = TypeChecker.typeNamed(annotationType).annotationsOf(
    element,
  );

  if (annotations.isEmpty) {
    return null;
  }

  return annotations.first;
}