HydratedMixin<State> mixin

A mixin which enables automatic state persistence for StateNotifier classes.

Superclass Constraints
  • StateNotifier<State>
Mixin Applications

Properties

debugState → State
A development-only way to access state outside of StateNotifier.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
hasListeners bool
If a listener has been added using addListener and hasn't been removed yet.
no setterinherited
id String
id is used to uniquely identify multiple instances of the same HydratedStateNotifier type. In most cases it is not necessary; however, if you wish to intentionally have multiple instances of the same HydratedStateNotifier, then you must override id and return a unique identifier for each HydratedStateNotifier instance in order to keep the caches independent of each other.
no setter
mounted bool
Whether dispose was called or not.
no setterinherited
onError ↔ ErrorListener?
A callback for error reporting if one of the listeners added with addListener throws.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state ↔ State
The current "state" of this StateNotifier.
getter/setter pairoverride
storageToken String
storageToken is used as registration token for hydrated storage.
no setter
stream Stream<State>
A broadcast stream representation of a StateNotifier.
no setterinherited

Methods

addListener(Listener<State> listener, {bool fireImmediately = true}) → RemoveListener
Subscribes to this object.
inherited
clear() Future<void>
clear is used to wipe or invalidate the cache of a HydratedStateNotifier. Calling clear will delete the cached state of the state notifier but will not modify the current state of the state notifier.
dispose() → void
Frees all the resources associated to this object.
inherited
fromJson(Map<String, dynamic> json) → State?
Responsible for converting the Map<String, dynamic> representation of the state into a concrete instance of the notifier state.
hydrate() → void
Populates the internal state storage with the latest state.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson(State state) Map<String, dynamic>?
Responsible for converting a concrete instance of the state into the the Map<String, dynamic> representation.
toString() String
A string representation of this object.
inherited
updateShouldNotify(State old, State current) bool
Whether to notify listeners or not when state changes
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited