Finds widgets using a widget predicate
.
Example:
expect(tester, hasWidget(find.byWidgetPredicate(
(Widget widget) => widget is Tooltip && widget.message == 'Back',
description: 'widget with tooltip "Back"',
)));
If description
is provided, then this uses it as the description of the
Finder and appears, for example, in the error message when the finder
fails to locate the desired widget. Otherwise, the description prints the
signature of the predicate function.
If the skipOffstage
argument is true (the default), then this skips
nodes that are Offstage or that are from inactive Routes.
Source
Finder byWidgetPredicate(WidgetPredicate predicate, { String description, bool skipOffstage: true }) { return new _WidgetPredicateFinder(predicate, description: description, skipOffstage: skipOffstage); }