byWidget method

Finder byWidget (Widget widget, { bool skipOffstage: true })

Finds widgets whose current widget is the instance given by the argument.

Sample code

// Suppose you have a button created like this:
Widget myButton = new Button(
  child: new Text('Update')
);

// You can find and tap on it like this:
tester.tap(find.byWidget(myButton));

If the skipOffstage argument is true (the default), then this skips nodes that are Offstage or that are from inactive Routes.

Implementation

Finder byWidget(Widget widget, { bool skipOffstage = true }) => _WidgetFinder(widget, skipOffstage: skipOffstage);