SharedPrefsService class
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
-
addToStringList(String key, String value)
→ Future<bool>
-
Adds a single item to a list of strings.
-
batchIncrementInts(Map<String, int> increments)
→ Future<void>
-
Batch update to increment multiple integer keys by specified values.
-
clear()
→ Future<bool>
-
Clears all values.
-
containsKey(String key)
→ bool
-
Checks if a key exists.
-
decrementInt(String key, {int decrementBy = 1})
→ Future<int?>
-
Decrements an integer value.
-
getAll()
→ Map<String, dynamic>
-
Retrieves all key-value pairs.
-
getBool(String key)
→ bool?
-
-
getBulk(List<String> keys)
→ Map<String, dynamic>
-
Retrieves multiple values for a list of keys.
-
getDateTime(String key)
→ DateTime?
-
Retrieves a DateTime value.
-
getDouble(String key)
→ double?
-
-
getInt(String key)
→ int?
-
-
getItemCount()
→ int
-
Counts the number of stored items.
-
getJson(String key)
→ Map<String, dynamic>?
-
Retrieves a JSON object by decoding a stored string.
-
getKeys()
→ Set<String>?
-
Retrieves all keys.
-
getKeysByPrefix(String prefix)
→ Set<String>
-
Retrieves all keys that start with a specified prefix.
-
getString(String key)
→ String?
-
Retrieves a string value.
-
getStringList(String key)
→ List<String>?
-
-
getValue<T>(String key)
→ T?
-
Retrieves a value by type.
-
incrementOrInitInt(String key, {int incrementBy = 1, int initialValue = 0})
→ Future<int>
-
Increments or initializes an integer value.
-
init()
→ Future<void>
-
Initializes SharedPreferences instance.
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(String key)
→ Future<bool>
-
Removes a value.
-
removeBulk(List<String> keys)
→ Future<void>
-
Removes multiple keys.
-
removeFromStringList(String key, String value)
→ Future<bool>
-
Removes a single item from a list of strings.
-
resetToDefaults(Map<String, dynamic> defaultValues)
→ Future<void>
-
Resets a list of keys to specified default values.
-
retrieveAndRemove(List<String> keys)
→ Map<String, dynamic>
-
Retrieves and removes values for a list of keys.
-
saveBool(String key, bool value)
→ Future<bool>
-
-
saveBulk(Map<String, dynamic> data)
→ Future<void>
-
Saves multiple key-value pairs in one go.
-
saveDateTime(String key, DateTime value)
→ Future<bool>
-
Saves a DateTime value as a string.
-
saveDouble(String key, double value)
→ Future<bool>
-
-
saveInt(String key, int value)
→ Future<bool>
-
-
saveJson(String key, Map<String, dynamic> json)
→ Future<bool>
-
Saves a JSON object by encoding it as a string.
-
saveString(String key, String value)
→ Future<bool>
-
Saves a string value.
-
saveStringList(String key, List<String> value)
→ Future<bool>
-
-
toggleBool(String key)
→ Future<bool?>
-
Toggles a boolean value.
-
toString()
→ String
-
A string representation of this object.
inherited
-
updateOrAppendToStringList(String key, List<String> newList)
→ Future<bool>
-
Updates a string list by replacing it if exists or appending if it doesn't.