whereMatcherType<T extends TextMatcher> method

Iterable<TextElement> whereMatcherType<T extends TextMatcher>({
  1. int? matcherIndex,
})

Returns a new lazy Iterable with all 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

Iterable<TextElement> whereMatcherType<T extends TextMatcher>({
  int? matcherIndex,
}) {
  return matcherIndex == null
      ? where((e) => e.matcherType == T)
      : where((e) => e.matcherType == T && e.matcherIndex == matcherIndex);
}