SharedPrefPro class
A production-ready local storage plugin for Flutter.
This plugin provides a simple key-value store for persistent data. It supports basic types like String, int, double, bool, List<String>, as well as Map and List for JSON storage.
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
-
clear(
) → Future< bool> - Removes all keys and values from the local storage.
-
containsKey(
String key) → Future< bool> -
Returns
trueif the local storage contains the givenkey. Note: If the key exists but has expired, it will still return true until get or remove is called, or use isExpired to check. -
get<
T> (String key) → Future< T?> -
Retrieves a value of type
Tfrom the local storage. -
getKeys(
) → Future< Set< String> > - Returns all keys currently stored in the local storage (excluding internal expiry keys).
-
isExpired(
String key) → Future< bool> -
Returns
trueif the givenkeyhas an expiration set and is now expired. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
String key) → Future< bool> -
Removes the value associated with
keyfrom the local storage. This also removes any associated expiration metadata. -
save<
T> (String key, T value, {Duration? expireIn}) → Future< bool> -
Saves a value of type
Tto the local storage. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → SharedPrefPro
-
The singleton instance of SharedPrefPro.
final