hydrated_riverpod library
An extension to package:riverpod which automatically persists and restores state_notifier and state states. Built to work with package:riverpod.
Get started at riverpod.dev 🚀
Classes
-
AlwaysAliveProviderBase<
State> - A base class for providers that never disposes themselves.
-
AsyncData<
T> - Creates an AsyncValue with a data.
-
AsyncError<
T> - Creates an AsyncValue in error state.
-
AsyncLoading<
T> - Creates an AsyncValue in loading state.
-
AsyncValue<
T> - An utility for safely manipulating asynchronous data.
-
AutoDisposeFutureProvider<
State> - A provider that asynchronously creates a single value.
-
AutoDisposeFutureProviderFamily<
State, Arg> - A class that allows building a FutureProvider from an external parameter.
-
AutoDisposeFutureProviderRef<
State> - An object used by providers to interact with other providers and the life-cycles of the application.
-
AutoDisposeProvider<
State> - A provider that exposes a read-only value.
-
AutoDisposeProviderBase<
State> - A base class for providers that destroy their state when no-longer listened.
-
AutoDisposeProviderElement<
State> - An AutoDisposeProviderElementBase for AutoDisposeProvider
-
AutoDisposeProviderElementBase<
State> - The ProviderElementBase of an AutoDisposeProviderBase.
-
AutoDisposeProviderFamily<
State, Arg> - A class that allows building a Provider from an external parameter.
-
AutoDisposeProviderRef<
State> - An object used by providers to interact with other providers and the life-cycles of the application.
- AutoDisposeRef
- A Ref for providers that are automatically destroyed when no-longer used.
-
AutoDisposeStateNotifierProvider<
Notifier extends StateNotifier< State> , State> - Creates a StateNotifier and expose its current state.
-
AutoDisposeStateNotifierProviderFamily<
Notifier extends StateNotifier< State> , State, Arg> - A class that allows building a StateNotifierProvider from an external parameter.
-
AutoDisposeStateNotifierProviderRef<
Notifier extends StateNotifier< State> , State> - An object used by providers to interact with other providers and the life-cycles of the application.
-
AutoDisposeStateProvider<
State> - A provider that expose a value which can be modified from outside.
-
AutoDisposeStateProviderElement<
State> - The ProviderElementBase for StateProvider
-
AutoDisposeStateProviderFamily<
State, Arg> -
AutoDisposeStateProviderRef<
State> - An object used by providers to interact with other providers and the life-cycles of the application.
-
AutoDisposeStreamProvider<
State> - Creates a stream and expose its latest event.
-
AutoDisposeStreamProviderFamily<
State, Arg> - A class that allows building a StreamProvider from an external parameter.
-
AutoDisposeStreamProviderRef<
State> - An object used by providers to interact with other providers and the life-cycles of the application.
-
Family<
State, Arg, FamilyProvider extends ProviderBase< State> > - A base class for all families
-
FamilyOverride<
Arg> -
Do not use: Internal object to used by ProviderContainer/
ProviderScope
to override the behavior of a "family" for part of the application. -
FutureProvider<
State> - A provider that asynchronously creates a single value.
-
FutureProviderFamily<
State, Arg> - A class that allows building a FutureProvider from an external parameter.
-
FutureProviderRef<
State> - An object used by providers to interact with other providers and the life-cycles of the application.
- HydratedAesCipher
- Default encryption algorithm. Uses AES256 CBC with PKCS7 padding.
-
HydratedAutoDisposeStateProvider<
State> - A provider that expose a value which can be modified from outside.
- HydratedAutoDisposeStateProviderBuilder
- Builds a AutoDisposeStateProvider.
-
HydratedAutoDisposeStateProviderFamily<
State, Arg> - HydratedAutoDisposeStateProviderFamilyBuilder
- Builds a HydratedAutoDisposeStateProviderFamily.
- HydratedCipher
- Abstract cipher can be implemented to customize encryption.
- HydratedRiverpod
- For example:
-
HydratedStateController<
State> - Specialized StateController which handles initializing the StateController state based on the persisted state. This allows state to be persisted across hot restarts as well as complete app restarts.
-
HydratedStateNotifier<
State> - Specialized StateNotifier which handles initializing the StateNotifier state based on the persisted state. This allows state to be persisted across hot restarts as well as complete app restarts.
-
HydratedStateProvider<
State> - A provider that expose a value which can be modified from outside.
-
HydratedStateProviderFamily<
State, Arg> - HydratedStateProviderFamilyBuilder
- Builds a StateProviderFamily.
- HydratedStorage
- Implementation of Storage which uses package:hive to persist and retrieve state changes from the local device.
- Override
-
An object used by ProviderContainer/
ProviderScope
to override the behavior of a provider/family for part of the application. -
Provider<
State> - A provider that exposes a read-only value.
-
ProviderBase<
State> - A base class for all providers.
- ProviderContainer
- An object that stores the state of the providers and allows overriding the behavior of a specific provider.
-
ProviderElement<
State> - A provider that exposes a read-only value.
-
ProviderElementBase<
State> - An internal class that handles the state of a provider.
-
ProviderFamily<
State, Arg> - A class that allows building a Provider from an external parameter.
-
ProviderListenable<
State> - A base class for all providers, used to consume a provider.
- ProviderObserver
- An object that listens to the changes of a ProviderContainer.
- ProviderOverride
- An object used by ProviderContainer to override the behavior of a provider for a part of the application.
-
ProviderRef<
State> - An object used by providers to interact with other providers and the life-cycles of the application.
-
ProviderSubscription<
State> - Represents the subscription to a provider
- Ref
- An object used by providers to interact with other providers and the life-cycles of the application.
-
StateController<
T> - A StateNotifier that allows modifying its state from outside.
-
StateNotifier<
T> - An observable class that stores a single immutable state.
-
StateNotifierProvider<
Notifier extends StateNotifier< State> , State> - Creates a StateNotifier and expose its current state.
-
StateNotifierProviderFamily<
Notifier extends StateNotifier< State> , State, Arg> - A class that allows building a StateNotifierProvider from an external parameter.
-
StateNotifierProviderRef<
Notifier extends StateNotifier< State> , State> - An object used by providers to interact with other providers and the life-cycles of the application.
-
StateProvider<
State> - A provider that expose a value which can be modified from outside.
-
StateProviderElement<
State> - The ProviderElementBase for StateProvider
-
StateProviderFamily<
State, Arg> -
StateProviderRef<
State> - An object used by providers to interact with other providers and the life-cycles of the application.
- Storage
- Interface which is used to persist and retrieve state changes.
-
StreamProvider<
State> - Creates a stream and expose its latest event.
-
StreamProviderFamily<
State, Arg> - A class that allows building a StreamProvider from an external parameter.
-
StreamProviderRef<
State> - An object used by providers to interact with other providers and the life-cycles of the application.
Mixins
-
AlwaysAliveProviderListenable<
State> - A base class for all providers, used to consume a provider.
-
HydratedMixin<
State> - A mixin which enables automatic state persistence for StateController and StateNotifier classes.
-
StateNotifierProviderOverrideMixin<
Notifier extends StateNotifier< State> , State> - Add overrideWithValue to AutoDisposeStateNotifierProvider
Extensions
-
AlwaysAliveAsyncProviderX
on AlwaysAliveProviderBase<
AsyncValue< State> > - Adds future and stream to providers that emit an AsyncValue
-
AsyncValueX
on AsyncValue<
T> - An extension that adds methods like when to an AsyncValue.
-
AutoDisposeAsyncProviderX
on AutoDisposeProviderBase<
AsyncValue< State> > - Adds future and stream to autoDispose providers that emit an AsyncValue
-
XAutoDisposeFamily
on Family<
State, Arg, FamilyProvider> - An extension that adds overrideWithProvider to Family.
-
XFamily
on Family<
State, Arg, FamilyProvider> - An extension that adds overrideWithProvider to Family.
Typedefs
-
Create<
T, R extends Ref> = T Function(R ref) - A callback used by providers to create the value exposed.
- ErrorListener = void Function(Object error, StackTrace? stackTrace)
- A callback that can be passed to StateNotifier.onError.
-
FamilyCreate<
T, R extends Ref, Arg> = T Function(R ref, Arg arg) - A Create equivalent used by Family.
-
Locator
= T Function<
T>() - A function that allows obtaining other objects.
- ProviderReference = Ref
- Alias for Ref
-
Reader
= T Function<
T>(ProviderBase< T> provider) - A function that reads the state of a provider.
- RemoveListener = void Function()
- A callback that can be used to remove a listener added with StateNotifier.addListener.
- SetupOverride = void Function({required ProviderBase origin, required ProviderBase override})
- An implementation detail for the override mechanism of providers
Exceptions / Errors
- CircularDependencyError
- An error thrown when a call to Ref.read/Ref.watch leads to a provider depending on itself.
-
DependencyNotFoundException<
T> -
Thrown when tried to call
LocatorMixin.read<T>()
, but theT
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.
- ProviderException
- Encapulates an exception thrown while building a provider.
- 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: