containsMatcherType<T extends TextMatcher> method

bool containsMatcherType<T extends TextMatcher>({
  1. int? matcherIndex,
})

Whether the iterable contains one or more TextElements that have type T as matcherType.

Pass an index number to the matcherIndex argument if the source list contains elements resulting from different matchers of the same type and therefore specifying only the type is not enough.

Implementation

bool containsMatcherType<T extends TextMatcher>({int? matcherIndex}) {
  return matcherIndex == null
      ? any((e) => e.matcherType == T)
      : any((e) => e.matcherType == T && e.matcherIndex == matcherIndex);
}