Selector0<S> class
Shows what builder returns for what selector picks with the
context, built again only when it picks something else: not ==,
lists, sets, maps and other iterables compared element by element (or
as shouldRebuild says), or when this widget is replaced. child is
handed to builder, as a Consumer's is.
Selector0<int>(
selector: (context) => context.watch<Cart>().items.length,
builder: (context, count, _) => Text('$count items'),
)
- Inheritance
-
- Object
- Widget
- StatefulWidget
- SingleChildStatefulWidget
- Selector0
- Implementers
Constructors
-
Selector0({required ValueWidgetBuilder<
S> builder, required S selector(BuildContext context), Key? key, ShouldRebuild<S> ? shouldRebuild, Widget? child}) -
Shows what
builderreturns for whatselectorpicks.const
Properties
-
builder
→ ValueWidgetBuilder<
S> -
Builds what this widget shows from what selector picked.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Tells this widget apart from its siblings; see Key.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selector → S Function(BuildContext context)
-
Picks what builder builds with, the providers it finds through the
context watched.
final
-
shouldRebuild
→ ShouldRebuild<
S> ? -
Whether to build again for what selector picked, given what it
picked before; null builds when the two differ.
final
Methods
-
createElement(
) → StatefulElement -
Inflates this widget into a new element for the tree.
inherited
-
createState(
) → State< Selector0< S> > -
Creates the state of a new element; it lives as long as the element.
override
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Adds what describes this widget in its element's description
(Element.describe) to
properties, those not worth showing (a default) left out; an override calls this first. A render object widget adds only what its render object does not show. Only Element.describe calls it: a frame never does.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited