findAnnotationByName function

ElementAnnotation? findAnnotationByName(
  1. Element element,
  2. String type
)

Implementation

ElementAnnotation? findAnnotationByName(Element element, String type) {
  ElementAnnotation? annotation;
  for (final element in element.metadata) {
    if ((element.element?.displayName == type ||
        element.element?.name == type)) {
      annotation = element;
      break;
    }
  }
  return annotation;
}