safeMatcher function

AnnotationMatcher safeMatcher(
  1. AnnotationMatcher matcher
)

Wraps an annotation matcher so that an error is not thrown.

Implementation

AnnotationMatcher safeMatcher(
  AnnotationMatcher matcher,
) =>
    (annotation) {
      try {
        return matcher(annotation);
      } on ArgumentError catch (e) {
        logWarning('Could not resolve $annotation: $e');
        return false;
      }
    };