StateNotifier<T> class
abstract
Abstract base class for state notifiers. Similar to Riverpod's StateNotifier but with enhanced functionality.
Constructors
- StateNotifier.new(T _state)
- Creates a new state notifier with the given initial state.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- mounted → bool
-
Gets whether this notifier is still mounted and active.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state ↔ T
-
Gets the current state.
getter/setter pair
-
stream
→ Stream<
T> -
Gets a stream of state changes.
no setter
Methods
-
addListener(
void listener(T)) → VoidCallback - Adds a listener that will be called whenever the state changes. Returns a function that can be called to remove the listener.
-
dispose(
) → void - Called when the notifier is about to be disposed. Override this method to perform cleanup.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeListener(
void listener(T)) → void - Removes a specific listener.
-
toString(
) → String -
A string representation of this object.
override
-
updateState(
T updater(T current)) → void - Updates the state using a function.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited