spotAllWidgets function

WidgetSelector<Widget> spotAllWidgets()

A WidgetSelector that matches all widgets in the widget tree.

final globalKeyWidgets = spotAllWidgets()
    .whereWidget(
      (widget) => widget.key is GlobalKey,
      description: 'with GlobalKey',
    )
    .snapshot();
print(globalKeyWidgets.discoveredWidgets);
// [View-[GlobalObjectKey TestFlutterView#81689],
// WidgetsApp-[GlobalObjectKey _MaterialAppState#5b870],
// ...

Implementation

WidgetSelector<Widget> spotAllWidgets() => WidgetSelector.all;