SharedPreferences class

Interface for accessing and modifying preference data.

For any particular set of preferences, there is a single instance of this class that all clients share.





hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


contains(String key) bool
Checks whether the preferences contains a preference. [...]
get<T>(String key, [T defaultValue]) → T
Retrieves a value from the preferences. [...]
getAll() Map<String, dynamic>
Retrieves all values from the preferences. [...]
getBoolean(String key, [bool defaultValue]) bool
Retrieves a boolean value from the preferences. [...]
getFloat(String key, [double defaultValue]) double
Retrieves a float value from the preferences. [...]
getInt(String key, [int defaultValue]) int
Retrieves an int value from the preferences. [...]
getLong(String key, [int defaultValue]) int
Retrieves a long value from the preferences. [...]
getString(String key, [String defaultValue]) String
Retrieves a string value from the preferences. [...]
getStringSet(String key, [Set<String> defaultValue]) Set<String>
Retrieves a set of string values from the preferences. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
A string representation of this object. [...]


operator ==(Object other) bool
The equality operator. [...]

Static Methods

open(String name, [int mode = 0]) Future<SharedPreferences>
See Context.getSharedPreferences.