InMemoryBackend class
A volatile storage backend that stores all data in memory.
InMemoryBackend implements the StorageBackend interface using a simple Map for data storage. All operations are synchronous in nature but wrapped in Futures to match the backend interface contract.
- Inheritance
-
- Object
- StorageBackend
- InMemoryBackend
Constructors
- InMemoryBackend()
- Creates a new empty InMemoryBackend.
-
InMemoryBackend.withData({Map<
String, dynamic> ? initialData}) - Creates a new InMemoryBackend pre-populated with initial data.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
isEmpty
→ Future<
bool> -
Returns
trueif the storage contains no key-value pairs.no setteroverride -
isNotEmpty
→ Future<
bool> -
Returns
trueif the storage contains one or more key-value pairs.no setteroverride - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clear(
) → Future< void> -
Removes all values from the storage.
override
-
close(
) → Future< void> -
Closes the storage and releases any associated resources.
override
-
container(
String name, {String? delimiter}) → Future< HyperStorageContainer> -
Creates a new HyperStorageContainer with the given
name.inherited -
containsKey(
String key) → Future< bool> -
Returns
trueif a value with the givenkeyexists in the storage.override -
get<
E extends Object> (String key, {List< Enum> ? enumValues}) → Future<E?> -
Retrieves a value of type
Eby itskey.inherited -
getAll(
Set< String> allowList) → Future<Map< String, dynamic> > -
Retrieves all key-value pairs from the storage.
override
-
getBool(
String key) → Future< bool?> -
Retrieves a bool value by its
key.override -
getBytes(
String key) → Future< Uint8List?> -
Retrieves a byte array by its
key.inherited -
getDateTime(
String key, {bool isUtc = false}) → Future< DateTime?> -
Retrieves a DateTime value by its
key.override -
getDouble(
String key) → Future< double?> -
Retrieves a double value by its
key.override -
getDuration(
String key) → Future< Duration?> -
Retrieves a Duration value by its
key.override -
getEnum<
E extends Enum> (String key, List< E> values) → Future<E?> -
Retrieves an enum value of type
Eby itskey.inherited -
getInt(
String key) → Future< int?> -
Retrieves an int value by its
key.override -
getJson(
String key) → Future< Map< String, dynamic> ?> -
Retrieves a JSON object by its
key.override -
getJsonList(
String key) → Future< List< Map< ?>String, dynamic> > -
Retrieves a list of JSON objects by its
key.override -
getKeys(
) → Future< Set< String> > -
Returns a set of all keys currently stored in the storage.
override
-
getString(
String key) → Future< String?> -
Retrieves a String value by its
key.override -
getStringList(
String key) → Future< List< String> ?> -
Retrieves a list of strings by its
key.override -
init(
) → Future< InMemoryBackend> -
Initializes the storage backend.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
remove(
String key) → Future< void> -
Removes a value by its
key.override -
removeAll(
Iterable< String> key) → Future<void> -
Removes multiple values by their keys in a single operation.
override
-
set<
E extends Object> (String key, E value) → Future< void> -
Saves a value of type
Ewith the givenkey.inherited -
setAll(
Map< String, dynamic> values) → Future<void> -
Saves multiple key-value pairs from a Map in a single operation.
override
-
setBool(
String key, bool value) → Future< void> -
Saves a bool value with the given
key.override -
setBytes(
String key, List< int> value) → Future<void> -
Saves a byte array with the given
key.inherited -
setDateTime(
String key, DateTime value) → Future< void> -
Saves a DateTime value with the given
key.override -
setDouble(
String key, double value) → Future< void> -
Saves a double value with the given
key.override -
setDuration(
String key, Duration value) → Future< void> -
Saves a Duration value with the given
key.override -
setEnum<
E extends Enum> (String key, E value) → Future< void> -
Saves an enum value of type
Ewith the givenkey.inherited -
setInt(
String key, int value) → Future< void> -
Saves an int value with the given
key.override -
setJson(
String key, Map< String, dynamic> value) → Future<void> -
Saves a JSON object (Map) with the given
key.override -
setJsonList(
String key, List< Map< value) → Future<String, dynamic> >void> -
Saves a list of JSON objects with the given
key.override -
setString(
String key, String value) → Future< void> -
Saves a String value with the given
key.override -
setStringList(
String key, List< String> value) → Future<void> -
Saves a list of strings with the given
key.override -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited