byElementType method

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

Finds widgets by searching for elements with a particular type.

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

The type argument must be a subclass of Element.

Sample code

expect(find.byElementType(SingleChildRenderObjectElement), findsOneWidget);

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

Implementation

Finder byElementType(Type type, { bool skipOffstage = true }) => _ElementTypeWidgetFinder(type, skipOffstage: skipOffstage);