common/providers/notifiers/client_pref_notifier library
Based on https://github.com/gamako/shared_preferences_riverpod/blob/master/lib/shared_preferences_riverpod.dart but bound to the specific client deviceIDs;
In essence this provides a SharedPreferences provider which, whenever set,
will store the current value under $currentDeviceId-$prefKey
in the system
preference allowing the app to save and restore local app settings.
Classes
-
MapPrefNotifier<
T> -
Converts the value of type parameter
T
to a String and persists it in SharedPreferences. -
PrefNotifier<
T> -
The type parameter
T
is the type of value that will be persisted inSharedPreferences
.
Functions
-
createMapPrefProvider<
T> ({required String prefKey, required T mapFrom(String?), required String mapTo(T)}) → dynamic -
Returns a
Provider
that can access the preference with any type you want. -
createPrefProvider<
T> ({required String prefKey, required T defaultValue}) → dynamic -
Returns the
Provider
that has access to the value of preferences.