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

outdated

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>(
  // default value function that was called when data is not presented in store
  // that can be depend on other riverpod providers
  (ref) => () => const AuthorizationValue.unauthorized(),
  store: HiveJsonStore(
    fromJson: (json) => AuthorizationValue.fromJson(json),
    toJson: (value) => value.toJson(),
  ),
  name: 'token',
);
2
likes
0
pub points
50%
popularity

Publisher

unverified uploader

Persistent store for riverpod package based on hive

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, hive, riverpod, rxdart

More

Packages that depend on riverpod_persistent_state