SharedPreferences class
Wraps NSUserDefaults (on iOS) and SharedPreferences (on Android), providing a persistent store for simple data.
Data is persisted to disk asynchronously.
Properties
- hashCode → int
- 
  The hash code for this object.
  no setterinherited
- runtimeType → Type
- 
  A representation of the runtime type of the object.
  no setterinherited
Methods
- 
  clear() → Future< bool> 
- Completes with true once the user preferences for the app has been cleared.
- 
  commit() → Future< bool> 
- Always returns true. On iOS, synchronize is marked deprecated. On Android, we commit every set.
- 
  containsKey(String key) → bool 
- 
  Returns true if the persistent storage contains the given key.
- 
  get(String key) → Object? 
- Reads a value of any type from persistent storage.
- 
  getBool(String key) → bool? 
- Reads a value from persistent storage, throwing an exception if it's not a bool.
- 
  getDouble(String key) → double? 
- Reads a value from persistent storage, throwing an exception if it's not a double.
- 
  getInt(String key) → int? 
- Reads a value from persistent storage, throwing an exception if it's not an int.
- 
  getKeys() → Set< String> 
- Returns all keys in the persistent storage.
- 
  getString(String key) → String? 
- Reads a value from persistent storage, throwing an exception if it's not a String.
- 
  getStringList(String key) → List< String> ?
- Reads a set of string values from persistent storage, throwing an exception if it's not a string set.
- 
  noSuchMethod(Invocation invocation) → dynamic 
- 
  Invoked when a nonexistent method or property is accessed.
  inherited
- 
  reload() → Future< void> 
- Fetches the latest values from the host platform.
- 
  remove(String key) → Future< bool> 
- Removes an entry from persistent storage.
- 
  setBool(String key, bool value) → Future< bool> 
- 
  Saves a boolean valueto persistent storage in the background.
- 
  setDouble(String key, double value) → Future< bool> 
- 
  Saves a double valueto persistent storage in the background.
- 
  setInt(String key, int value) → Future< bool> 
- 
  Saves an integer valueto persistent storage in the background.
- 
  setString(String key, String value) → Future< bool> 
- 
  Saves a string valueto persistent storage in the background.
- 
  setStringList(String key, List< String> value) → Future<bool> 
- 
  Saves a list of strings valueto persistent storage in the background.
- 
  toString() → String 
- 
  A string representation of this object.
  inherited
Operators
- 
  operator ==(Object other) → bool 
- 
  The equality operator.
  inherited
Static Methods
- 
  getInstance() → Future< SharedPreferences> 
- Loads and parses the SharedPreferences for this app from disk.
- 
  resetStatic() → void 
- Resets class's static values to allow for testing of setPrefix flow.
- 
  setMockInitialValues(Map< String, Object> values) → void
- Initializes the shared preferences with mock values for testing.
- 
  setPrefix(String prefix, {Set< String> ? allowList}) → void
- Sets the prefix that is attached to all keys for all shared preferences.