PlayxAsyncPrefs class abstract
An abstract class that provides an asynchronous interface for accessing and manipulating SharedPreferences data.
This class encapsulates methods for storing and retrieving various data
types such as String, int, double, and bool using a shared preferences
instance, which is managed 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
-
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
-
Getter for the SharedPreferencesAsync instance.
no setter
Static Methods
-
clear(
) → Future< void> - Clears all data in the shared preferences.
-
create(
) → Future< SharedPreferencesAsync> - Initializes and returns a new instance of SharedPreferencesAsync.
-
dispose(
) → Future< void> - Disposes the SharedPreferencesAsync instance.
-
find(
String key) → Future< Object?> -
Finds and returns the value associated with the given
keyas anObject. -
getBool(
String key, {bool fallback = false}) → Future< bool> -
Retrieves the value associated with the given
keyas abool. -
getDouble(
String key, {double fallback = -1}) → Future< double> -
Retrieves the value associated with the given
keyas adouble. -
getInt(
String key, {int fallback = -1}) → Future< int> -
Retrieves the value associated with the given
keyas anint. -
getString(
String key, {String fallback = ''}) → Future< String> -
Retrieves the value associated with the given
keyas aString. -
maybeGetBool(
String key) → Future< bool?> -
Retrieves the value associated with the given
keyas abool. -
maybeGetDouble(
String key) → Future< double?> -
Retrieves the value associated with the given
keyas adouble. -
maybeGetInt(
String key) → Future< int?> -
Retrieves the value associated with the given
keyas anint. -
maybeGetString(
String key) → Future< String?> -
Retrieves the value associated with the given
keyas aString. -
remove(
String key) → Future< void> -
Removes the value associated with the given
key. -
setBool(
String key, bool value) → Future< void> -
Sets the value associated with the given
keyas abool. -
setDouble(
String key, double value) → Future< void> -
Sets the value associated with the given
keyas adouble. -
setInt(
String key, int value) → Future< void> -
Sets the value associated with the given
keyas anint. -
setMockInitialValues(
Map< String, Object> values) → void - Sets mock initial values for testing purposes.
-
setString(
String key, String value) → Future< void> -
Sets the value associated with the given
keyas aString.