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

sharedPrefs SharedPreferencesAsync
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 key as an Object.
getBool(String key, {bool fallback = false}) Future<bool>
Retrieves the value associated with the given key as a bool.
getDouble(String key, {double fallback = -1}) Future<double>
Retrieves the value associated with the given key as a double.
getInt(String key, {int fallback = -1}) Future<int>
Retrieves the value associated with the given key as an int.
getString(String key, {String fallback = ''}) Future<String>
Retrieves the value associated with the given key as a String.
maybeGetBool(String key) Future<bool?>
Retrieves the value associated with the given key as a bool.
maybeGetDouble(String key) Future<double?>
Retrieves the value associated with the given key as a double.
maybeGetInt(String key) Future<int?>
Retrieves the value associated with the given key as an int.
maybeGetString(String key) Future<String?>
Retrieves the value associated with the given key as a String.
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 key as a bool.
setDouble(String key, double value) Future<void>
Sets the value associated with the given key as a double.
setInt(String key, int value) Future<void>
Sets the value associated with the given key as an int.
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 key as a String.