TestSharedPreferences class
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.
-
getAs<T>(String key)
→ T?
-
-
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 list.
-
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
value
to persistent storage in the background.
-
setDouble(String key, double value)
→ Future<bool>
-
Saves a double
value
to persistent storage in the background.
-
setInt(String key, int value)
→ Future<bool>
-
Saves an integer
value
to persistent storage in the background.
-
setString(String key, String value)
→ Future<bool>
-
Saves a string
value
to persistent storage in the background.
-
setStringList(String key, List<String> value)
→ Future<bool>
-
Saves a list of strings
value
to persistent storage in the background.
-
toString()
→ String
-
A string representation of this object.
inherited
-
update(String key, Object? value)
→ Future<bool>
-