spot<W extends Widget> function

  1. @useResult
WidgetSelector<W> spot<W extends Widget>({
  1. List<WidgetSelector<Widget>> parents = const [],
  2. List<WidgetSelector<Widget>> children = const [],
})

Creates a chainable WidgetSelector that matches a all Widgets of type W in widget tree.

spot<SomeWidget>() is the most common way to chain selectors.

This selector compares the Widgets by runtimeType rather than by super type (see WidgetTypeFilter). This makes sure that e.g. spot<Align>() does not accidentally match a Center Widget, that extends Align.

spot ignores Offstage widgets. To find offstage widgets, use spotOffstage().spot<MyWidget>(). See spotOffstage and spotAllWidgets

Implementation

@useResult
WidgetSelector<W> spot<W extends Widget>({
  List<WidgetSelector> parents = const [],
  List<WidgetSelector> children = const [],
}) {
  return _global.spot<W>(
    parents: parents,
    children: children,
  );
}