hydrated 1.0.0+2
hydrated: ^1.0.0+2 copied to clipboard
An automatically persisted BehaviorSubject with simple hydration for Flutter. Intended for use with the BLoC pattern.
Hydrated #
Hydrated provides a BehaviorSubject that automatically persists to Flutter's local storage. An async hydrate()
method rehydrates on command!
Easy to consume #
All values are persisted with shared_preferences
and restored with hydrate()
at next app launch.
final count$ = HydratedSubject<int>("count", seedValue: 0); // persist
await count$.hydrate(); // hydrate
count$.add(42); // this value will be available on next app launch
Ready for BLoC #
class _Bloc {
/// persist
final count$ = HydratedSubject<int>("count", seedValue: 0);
_Bloc() {
/// hydrate
this.count$.hydrate();
}
// ...
}
Standard types #
We support all shared_preferences
types.
int
double
bool
String
List<String>
Reliable #
Hydrated is mock tested with all supported types and is dogfooded by its creator.
