WidgetSelector<W extends Widget> class
Represents a chain of widgets in the widget tree that can be asserted
Compared to normal Finder, this gives great error messages along the chain
- Available Extensions
- AlignSelector
- AnyTextSelector
- CircularProgressIndicatorSelector
- ColumnSelector
- ConstrainedBoxSelector
- ContainerSelector
- CreateMatchers
- DefaultWidgetSelectors
- DiagnosticPropWidgetSelector
- EditableTextSelector
- EffectiveTextSelector
- ElevatedButtonSelector
- FloatingActionButtonSelector
- GridViewSelector
- IconButtonSelector
- IconSelector
- ImageSelector
- LinearProgressIndicatorSelector
- ListTileSelector
- MutateStages
- OpacitySelector
- OutlinedButtonSelector
- PropSelectorQueries
- QuantityMatchers
- QuantitySelectors
- ReadSingleSnapshot
- RelativeSelectors
- RowSelector
- SafeAreaSelector
- SelectableTextSelector
- SelectorQueries
- SelectorScreenshotExtension
- SelectorToSnapshot
- SemanticsSelector
- SizedBoxSelector
- SliderSelector
- SpotToFinder
- SwitchSelector
- TextButtonSelector
- TextFieldSelector
- TextSelector
- TooltipSelector
- WidgetSelectorProp
- WrapSelector
Constructors
-
WidgetSelector({required List<
ElementFilter> stages, @Deprecated('Use quantityConstraint instead') ExpectedQuantity expectedQuantity = ExpectedQuantity.multi, QuantityConstraint? quantityConstraint, WidgetPresence? widgetPresence, W mapElementToWidget(Element element)?}) - Constructor for creating a WidgetSelector.
Properties
-
children
→ List<
WidgetSelector< Widget> > -
All child selectors of all stages this widget selector depends on
no setter
- expectedQuantity → ExpectedQuantity
-
Whether this selector expects to find a single or multiple widgets
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- mapElementToWidget → W Function(Element element)
-
Overwrite this method when
W
is a synthetic widget like AnyText that combines multiple widgets of similar (but not exact) Typefinal -
parents
→ List<
WidgetSelector< Widget> > -
All parent selectors of all stages this widget selector depends on
no setter
- quantityConstraint → QuantityConstraint
-
The number of widgets that this selector expects to find
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
self
→ WidgetSelector<
W> -
The WidgetSelector the chainable methods build upon.
no setter
-
stages
→ List<
ElementFilter> -
The list of filters which are used to narrow down the selection of widgets in the tree
final
- type → Type
-
The runtime type of the widget this selector is intended for.
no setter
- widgetPresence → WidgetPresence
-
Whether to include offstage widgets in the selection
final
Methods
-
atIndex(
int index) → WidgetSelector< W> -
Selects the widget at a specified
index
in the list of found widgets.inherited -
copyWith(
{List< ElementFilter> ? stages, ExpectedQuantity? expectedQuantity, QuantityConstraint? quantityConstraint, WidgetPresence? widgetPresence, W mapElementToWidget(Element element)?}) → WidgetSelector<W> - Returns a new instance of WidgetSelector with some properties replaced with new values.
-
first(
) → WidgetSelector< W> -
Selects the first of n widgets
inherited
-
isAnyCombined(
) → bool - Recursively checks if this or any parent selector includes onstage and offstage widgets
-
isAnyOffstage(
) → bool - Recursively checks if this or any parent selector includes offstage widgets
-
last(
) → WidgetSelector< W> -
Selects the last of n widgets
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
overrideWidgetPresence(
WidgetPresence presence) → WidgetSelector< W> -
Creates a WidgetSelector that includes offstage widgets in the selection.
inherited
-
spot<
W extends Widget> ({List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const []}) → WidgetSelector<Widget> >W> -
Creates a WidgetSelector that matches a all Widgets of
type
W
that are in the scope of the parent WidgetSelector.inherited -
spotElement<
W extends Widget> (Element element, {List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const []}) → WidgetSelector<Widget> >W> -
Creates a WidgetSelector that finds the widget that is associated with
element
inherited -
spotIcon(
IconData icon, {List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const []}) → WidgetSelector<Widget> >Icon> -
Creates a WidgetSelector that finds all Icon widgets showing
icon
inherited -
spotIcons(
IconData icon, {List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const []}) → WidgetSelector<Widget> >Icon> -
Creates a WidgetSelector that finds all Icon widgets based on the
icon
inherited -
spotKey<
W extends Widget> (Key key, {List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const []}) → WidgetSelector<Widget> >W> -
Creates a WidgetSelector that finds widgets with the given
key
.inherited -
spotKeys<
W extends Widget> (Key key, {List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const []}) → WidgetSelector<Widget> >W> -
Creates a WidgetSelector that finds all widgets with the given
key
inherited -
spotOffstage(
{List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const []}) → WidgetSelector<Widget> >Widget> -
Creates a WidgetSelector that includes offstage widgets in the selection.
inherited
-
spotSingle<
W extends Widget> ({List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const []}) → WidgetSelector<Widget> >W> -
Creates a WidgetSelector that excludes offstage widgets from the selection.
inherited
-
spotSingleIcon(
IconData icon, {List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const []}) → WidgetSelector<Widget> >Icon> -
Creates a WidgetSelector that finds a single Icon based on the
icon
inherited -
spotSingleKey<
W extends Widget> (Key key, {List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const []}) → WidgetSelector<Widget> >W> -
Creates a WidgetSelector that finds a single widget with the given
key
.inherited -
spotSingleText<
W extends Widget> (String text, {List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const [], bool findRichText = false}) → WidgetSelector<Widget> >W> -
Creates a WidgetSelector that finds a single Text, EditableText or
RichText where
text
is the contentinherited -
spotSingleWidget<
W extends Widget> (W widget, {List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const []}) → WidgetSelector<Widget> >W> -
Creates a WidgetSelector that finds
widget
by identity and returns only that widgetinherited -
spotText(
Pattern text, {List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const [], bool exact = false}) → WidgetSelector<Widget> >AnyText> -
Creates a WidgetSelector that finds text within the parent
inherited
-
spotTexts<
W extends Widget> (String text, {List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const [], bool findRichText = false}) → WidgetSelector<Widget> >W> -
Creates a WidgetSelector that finds all Text, EditableText or
RichText where
text
is the contentinherited -
spotTextWhere(
void match(Subject< String> ), {List<WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const [], String? description}) → WidgetSelector<Widget> >AnyText> -
Creates a WidgetSelector that finds text matching
match
in the parentinherited -
spotWidget<
W extends Widget> (W widget, {List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const []}) → WidgetSelector<Widget> >W> -
Creates a WidgetSelector that finds
widget
by identity and returns all occurrences of it in the widget treeinherited -
spotWidgets<
W extends Widget> (W widget, {List< WidgetSelector< parents = const [], List<Widget> >WidgetSelector< children = const []}) → WidgetSelector<Widget> >W> -
Creates a WidgetSelector that finds all
widget
by identityinherited -
toString(
) → String -
A string representation of this object.
override
-
toStringBreadcrumb(
) → String - Generates a breadcrumb-like string representation of this selector.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
all
→ WidgetSelector<
Widget> -
Matches any widget currently mounted
final
Static Methods
-
defaultMapElementToWidget<
W> (Element element) → W -
Default mapping function to convert an Element to a widget of type
W
.
Constants
- inheritanceSeparator → const String
- Separator indicating a parent-child relationship between selectors
- stageSeparator → const String
- Separator splitting stages of a selector