KeyValueStorage class abstract
Interface for key-value storage operations, allowing storage and retrieval of various data types. Referenced from StorageManager.
- Implemented types
- Implementers
Constructors
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(
) → void - Removes all entries from the storage.
-
contains(
String key) → bool -
Checks whether the key exists in the storage.
keyKey to check. Returns true if a value is stored under the key (regardless of type). -
getBool(
String key, bool defaultValue) → bool -
Gets a boolean value.
Returns defaultValue if the key is missing or the stored type is not bool.
keyLookup key.defaultValueValue to return when not found or type mismatch. Returns Stored bool or defaultValue. -
getDouble(
String key, double defaultValue) → double -
Gets a 64-bit floating-point value.
Returns defaultValue if the key is missing or the stored type is not double.
keyLookup key.defaultValueValue to return when not found or type mismatch. Returns Stored double or defaultValue. -
getFloat(
String key, double defaultValue) → double -
Gets a 32-bit floating-point value.
Returns defaultValue if the key is missing or the stored type is not float.
keyLookup key.defaultValueValue to return when not found or type mismatch. Returns Stored float or defaultValue. -
getInt(
String key, int defaultValue) → int -
Gets a 32-bit integer value.
Returns defaultValue if the key is missing or the stored type is not int.
keyLookup key.defaultValueValue to return when not found or type mismatch. Returns Stored int32 or defaultValue. -
getKeys(
) → List< String> - Returns all keys currently stored. Returns List of keys. Order is implementation-defined (not guaranteed).
-
getLong(
String key, int defaultValue) → int -
Gets a 64-bit integer value.
Returns defaultValue if the key is missing or the stored type is not long.
keyLookup key.defaultValueValue to return when not found or type mismatch. Returns Stored int64 or defaultValue. -
getString(
String key, String defaultValue) → String -
Gets a string value.
Returns defaultValue if the key is missing or the stored type is not string.
keyLookup key.defaultValueValue to return when not found or type mismatch. Returns Stored string or defaultValue. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
putBool(
String key, bool value) → void -
Stores a boolean value under the key, replacing any existing value.
keyKey to set.valueValue to store. -
putDouble(
String key, double value) → void -
Stores a 64-bit floating-point value under the key, replacing any existing value.
keyKey to set.valueValue to store. -
putFloat(
String key, double value) → void -
Stores a 32-bit floating-point value under the key, replacing any existing value.
keyKey to set.valueValue to store. -
putInt(
String key, int value) → void -
Stores a 32-bit integer value under the key, replacing any existing value.
keyKey to set.valueValue to store. -
putLong(
String key, int value) → void -
Stores a 64-bit integer value under the key, replacing any existing value.
keyKey to set.valueValue to store. -
putString(
String key, String value) → void -
Stores a string value under the key, replacing any existing value.
keyKey to set.valueValue to store. -
remove(
String key) → void -
Removes a value by key. No-op if the key does not exist.
keyKey to remove. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited