riverpod_persistent_state 2.0.0 copy "riverpod_persistent_state: ^2.0.0" to clipboard
riverpod_persistent_state: ^2.0.0 copied to clipboard

Persistent store for riverpod package based on hive

Persistent riverpod store based on hive

Features #

Store state in persistent memory and restore it after application restarts

Getting started #

install #

Execute script in project directory, or add dependency in pubspec.yaml

flutter pub add riverpod_persistent_state

Usage #

Define provider with unique name and use it as state provider after

final tokenProvider = PersistentStateProvider<AuthorizationValue>(
  store: HiveJsonStore(
    defaultValue: () => const AuthorizationValue.unauthorized()
    fromJson: (json) => AuthorizationValue.fromJson(json),
    boxName: 'token',
  ),
);
1
likes
120
points
58
downloads

Publisher

unverified uploader

Weekly Downloads

Persistent store for riverpod package based on hive

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, hive, riverpod, rxdart

More

Packages that depend on riverpod_persistent_state