HydratedStateNotifier<State> class
abstract
- Inheritance
-
- Object
- StateNotifier<
State> - HydratedStateNotifier
- Mixed in types
-
- HydratedMixin<
State>
- HydratedMixin<
- Implementers
Constructors
- HydratedStateNotifier(State state, {HydratedStorage? storage, String id = '', int version = 1})
Properties
- debugState → State
-
A development-only way to access state outside of StateNotifier.
no setterinherited
- debugSynchronized → bool
-
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.
final
- 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 pairinherited
- storage → HydratedStorage
-
final
- storagePrefix → String
-
Storage prefix which can be overridden to provide a custom
storage namespace.
Defaults to runtimeType but should be overridden in cases
where stored data should be resilient to obfuscation or persist
between debug/release builds.
no setterinherited
- storageToken → String
-
storageToken
is used as registration token for hydrated storage. Composed of storagePrefix and id.no setterinherited -
stream
→ Stream<
State> -
A broadcast stream representation of a StateNotifier.
no setterinherited
- version → int
-
version is used to identify the version of this storage instance.
This can be used to perform migrations.
In most cases it is not necessary to use it;
final
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 bloc
but will not modify the current state of the bloc.
inherited
-
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 bloc state into a concrete instance of the bloc state.inherited -
hydrate(
) → void -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readSavedState(
) → State? -
inherited
-
saveState(
State change) → void -
inherited
-
toJson(
State state) → Map< String, dynamic> ? -
Responsible for converting a concrete instance of the bloc state
into the the
Map<String, dynamic>
representation.inherited -
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