SharedPreferencesExtensions extension

Extensions for primitive type

on

Methods

getBool(String key) Future<bool?>
Reads a value from persistent storage, return a future that completes with an error if it's not a bool.
getDouble(String key) Future<double?>
Reads a value from persistent storage, return a future that completes with an error if it's not a double.
getInt(String key) Future<int?>
Reads a value from persistent storage, return a future that completes with an error if it's not a int.
getKeys() Future<Set<String>>
Returns all keys in the persistent storage.
getObject(String key, [Decoder<Object?>? decoder]) Future<Object?>
Reads a value of any type from persistent storage.
getString(String key) Future<String?>
Reads a value from persistent storage, return a future that completes with an error if it's not a String.
getStringList(String key) Future<List<String>?>
Reads a value from persistent storage, return a future that completes with an error if it's not a string set.
setBool(String key, bool? value) Future<void>
Saves a boolean value to persistent storage in the background.
setDouble(String key, double? value) Future<void>
Saves a double value to persistent storage in the background.
setInt(String key, int? value) Future<void>
Saves an integer value to persistent storage in the background.
setString(String key, String? value) Future<void>
Saves a string value to persistent storage in the background.
setStringList(String key, List<String>? value) Future<void>
Saves a list of strings value to persistent storage in the background.