byWidget method

Finder byWidget(
  1. Widget widget, {
  2. bool skipOffstage = true,
})

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

Sample code

// Suppose there is a button created like this:
Widget myButton = const Button(
  child: Text('Update')
);

// It can be found and tapped 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 }) => _ExactWidgetFinder(widget, skipOffstage: skipOffstage);