byType method

Finder byType(
  1. Type type, {
  2. bool skipOffstage = true,
})

Finds widgets by searching for widgets with a particular type.

This does not do subclass tests, so for example byType(StatefulWidget) will never find anything since StatefulWidget is an abstract class.

The type argument must be a subclass of Widget.

Sample code

expect(find.byType(IconButton), findsOneWidget);

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

See also:

Implementation

Finder byType(Type type, { bool skipOffstage = true }) => _TypeWidgetFinder(type, skipOffstage: skipOffstage);