SimpleSharedPref class
The SimpleSharedPref
class provides easy access to shared preferences in Flutter.
It follows the singleton design pattern.
Constructors
-
Creates an instance of the
SimpleSharedPref
class.factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- preferences → SharedPreferences?
-
getter for shared preferences in case you need it
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → Future< bool> - Clears all values in the shared preferences.
-
containsKey(
dynamic key) → bool -
Checks if a value exists in the shared preferences based on the provided
key
. -
getValue<
T> ({required dynamic key}) → T? -
Retrieves a value from the shared preferences based on the provided
key
. -
init(
{bool allowEncryptAndDecrypt = true}) → Future< void> - Initializes the shared preferences instance.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeValue(
dynamic key) → Future< bool> -
Removes a value from the shared preferences based on the provided
key
. -
setValue<
T> ({required dynamic key, required T value}) → Future< bool> -
Sets a value in the shared preferences with the provided
key
andvalue
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited