hydrated_state_notifier library
An extension to package:state_notifier which automatically persists and restores provider states.
Built to work with package:state_notifier.
Classes
-
HydratedStateController<
State> - A HydratedStateNotifier that allows modifying its state from outside.
-
HydratedStateNotifier<
State> - HydratedStorage
- Interface which is used to persist and retrieve state changes.
-
StateNotifier<
T> - An observable class that stores a single immutable state.
Mixins
-
HydratedMixin<
State> - A mixin which enables automatic state persistence for StateNotifier class.
- LocatorMixin
- A mixin that adds service location capability to an object.
Typedefs
- ErrorListener = void Function(Object error, StackTrace? stackTrace)
- A callback that can be passed to StateNotifier.onError.
-
FromJsonCallback<
State> = State? Function(Map< String, dynamic> json) -
Listener<
T> = void Function(T state) - A listener that can be added to a StateNotifier using StateNotifier.addListener.
-
Locator
= T Function<
T>() - A function that allows obtaining other objects.
- RemoveListener = void Function()
- A callback that can be used to remove a listener added with StateNotifier.addListener.
-
StateUpdateCallback<
State> = State Function(State state) -
ToJsonCallback<
State> = Map< String, dynamic> ? Function(State state)
Exceptions / Errors
-
DependencyNotFoundException<
T> -
Thrown when tried to call LocatorMixin.read<T>(), but the
T
was not found.s - HydratedCyclicError
- Reports that an object could not be serialized due to cyclic references. When the cycle is detected, a HydratedCyclicError is thrown.
- HydratedUnsupportedError
- Reports that an object could not be serialized. The unsupportedObject field holds object that failed to be serialized.
- StateNotifierListenerError
- An error thrown when tried to update the state of a StateNotifier, but at least of the listeners threw.
- StorageNotFound
- Exception thrown if there was no HydratedStorage specified. This is most likely due to forgetting to setup the HydratedStorage: