StateSignalListener<T> class
Rebuilds its child whenever a StateSignal changes.
This component removes the need to manually call:
signal.listen((_) => setState(() {}));
Instead, put the signal-dependent UI inside this listener:
StateSignalListener(answers, (items) {
return Column(
children: [
for (final item in items) AnswerCard(item),
],
);
});
- Inheritance
-
- Object
- FlintNode
- FlintComponent
- StatefulComponent
- StateSignalListener
Constructors
-
StateSignalListener(StateSignal<
T> signal, StateSignalBuilder<T> builder) -
Creates a component that rebuilds when
signalchanges.
Properties
-
builder
↔ StateSignalBuilder<
T> -
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- preserveState → bool
-
Whether Flint should preserve this component instance across parent
rerenders when the runtime type and tree position match.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
signal
↔ StateSignal<
T> -
getter/setter pair
Methods
-
attach(
void scheduleRender()) → void -
Attaches the render scheduler used by setState.
inherited
-
build(
) → View? -
Builds this component's renderable output.
override
-
didMount(
) → void -
Called after the component is first mounted in the browser.
override
-
didUpdate(
) → void -
Called after the component updates following a rerender.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setState(
FlintStateUpdater update, {bool render = true}) → void -
Applies
updateand schedules this component to render again.inherited -
shouldUpdate(
covariant FlintComponent next) → bool -
Whether this component should rerender when it is updated from a new
instance in the parent tree.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateFrom(
covariant StateSignalListener< T> next) → void -
Receives the next component instance when Flint preserves this instance.
override
-
willUnmount(
) → void -
Called before the component is removed from the tree.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited