ofSubstring method
- String substring, {
- bool skipOffstage = true,
- FinderBase<
Element> ? descendentOf,
Finds all non-overlapping occurrences of the given substring
in the
static text widgets and returns the TextRanges.
If the skipOffstage
argument is true (the default), then this skips
static text inside widgets that are Offstage, or that are from inactive
Routes.
If the descendentOf
argument is non-null, this method only searches in
the descendants of that parameter for the given substring.
This finder uses the Pattern.allMatches method to match the substring in the text. After finding a matching substring in the text, the method continues the search from the end of the match, thus skipping overlapping occurrences of the substring.
Implementation
FinderBase<TextRangeContext> ofSubstring(String substring, { bool skipOffstage = true, FinderBase<Element>? descendentOf }) {
final _TextContainingWidgetFinder textWidgetFinder = _TextContainingWidgetFinder(substring, skipOffstage: skipOffstage, findRichText: true);
final Finder elementFinder = descendentOf == null
? textWidgetFinder
: _DescendantWidgetFinder(descendentOf, textWidgetFinder, matchRoot: true, skipOffstage: skipOffstage);
return _StaticTextRangeFinder(elementFinder, substring);
}