Prefs class
The App's Preferences.
Constructors
- Prefs()
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
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
instance
→ Future<
SharedPreferences> -
Loads and parses the SharedPreferences for this app from disk.
no setter
Static Methods
-
clear(
) → Future< bool> - Completes with true once the user preferences for the app has been cleared.
-
containsKey(
String? key) → bool -
Returns true if persistent storage the contains the given
key
. Return null if key is null -
containsKeyF(
String? key) → Future< bool> -
Returns true if persistent storage the contains the given
key
. Return null if key is null -
dispose(
) → void - Best to clean up by calling this function in the State object's dispose() function.
-
get(
String? key) → Object? - Reads a value of any type from persistent storage. Return null if key is null.
-
getBool(
String? key, [bool? defValue]) → bool - Return false if key is null
-
getBoolF(
String? key, [bool? defValue]) → Future< bool> - Returns a Future. Returns false if key is null.
-
getDouble(
String? key, [double? defValue]) → double - Returns 0 if key is null.
-
getDoubleF(
String? key, [double? defValue]) → Future< double> - Returns a Future. Returns 0 if key is null.
-
getF(
String? key) → Future< Object?> - Returns a Future. Return null if key is null
-
getInstance(
) → Future< SharedPreferences> - Loads and parses the SharedPreferences for this app from disk.
-
getInt(
String? key, [int? defValue]) → int - Returns 0 if key is null.
-
getIntF(
String? key, [int? defValue]) → Future< int> - Returns a Future. Returns 0 if key is null.
-
getKeys(
) → Set< String> - Returns all keys in the persistent storage.
-
getKeysF(
) → Future< Set< String> > - Returns a Future.
-
getString(
String? key, [String? defValue]) → String - Returns '' if key is null.
-
getStringF(
String? key, [String? defValue]) → Future< String> - Returns a Future. Returns '' if key is null.
-
getStringList(
String? key, [List< String> ? defValue]) → List<String> - Returns empty List if key is null.
-
getStringListF(
String? key, [List< String> ? defValue]) → Future<List< String> > - Returns a Future. Returns empty List if key is null.
-
init(
) → Future< SharedPreferences> - Initialize the SharedPreferences object in the State object's iniState() function.
-
initAsync(
) → Future< bool> - Initialize the SharedPreferences object and returns true when completed.
-
initCalled(
) → bool - Determine if init was called
-
ready(
) → bool - Indicate if Preferences is ready
-
reload(
) → Future< void> - Fetches the latest values from the host platform. Use this method to observe modifications that were made in native code (without using the plugin) while the app is running.
-
remove(
String? key) → Future< bool> - Removes an entry from persistent storage. Returns false if key is null.
-
setBool(
String? key, bool? value) → Future< bool> -
Saves a boolean
value
to persistent storage in the background. Returns false if key is null. -
setDouble(
String? key, double? value) → Future< bool> -
Saves a double
value
to persistent storage in the background. Android doesn't support storing doubles, so it will be stored as a float. Returns false if key is null. -
setInt(
String? key, int? value) → Future< bool> -
Saves an integer
value
to persistent storage in the background. Returns null if key is null. -
setPrefix(
String prefix, {Set< String> ? allowList}) → bool - Sets the prefix that is attached to all keys for all shared preferences. Return false if called after SharedPreferences was instantiated.
-
setString(
String? key, String? value) → Future< bool> -
Saves a string
value
to persistent storage in the background. Returns false if key is null. -
setStringList(
String? key, List< String> ? value) → Future<bool> -
Saves a list of strings
value
to persistent storage in the background. Returns false if key is null.