bySubtype<T extends Widget> method

Finder bySubtype<T extends Widget>({
  1. bool skipOffstage = true,
})

Finds widgets by searching for widgets implementing a particular type.

This matcher accepts subtypes. For example a bySubtype<StatefulWidget>() will find any stateful widget.

Sample code

expect(find.bySubtype<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:

  • byType, which does not do subtype tests.

Implementation

Finder bySubtype<T extends Widget>({ bool skipOffstage = true }) => _SubtypeWidgetFinder<T>(skipOffstage: skipOffstage);