An abstract class that defines the contract for a storage backend.
This class provides a base implementation for creating custom storage solutions that can persist data to various storage mechanisms (files, databases, etc.). It includes default implementations for common operations like handling JSON, lists, and date/time objects, reducing the boilerplate needed when implementing a new backend.
- Implemented types
- Implementers
Constructors
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.
inherited
-
close(
) → Future< void> -
Closes the storage and releases any associated resources.
inherited
-
container(
String name, {String? delimiter}) → Future< HyperStorageContainer> -
Creates a new HyperStorageContainer with the given
name. -
containsKey(
String key) → Future< bool> -
Returns
trueif a value with the givenkeyexists in the storage.inherited -
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.
inherited
-
getBool(
String key) → Future< bool?> -
Retrieves a bool value by its
key.inherited -
getBytes(
String key) → Future< Uint8List?> -
Retrieves a byte array by its
key.override -
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.inherited -
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.override -
getInt(
String key) → Future< int?> -
Retrieves an int value by its
key.inherited -
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.
inherited
-
getString(
String key) → Future< String?> -
Retrieves a String value by its
key.inherited -
getStringList(
String key) → Future< List< String> ?> -
Retrieves a list of strings by its
key.override -
init(
) → Future< void> - Initializes the storage backend.
-
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.inherited -
removeAll(
Iterable< String> keys) → Future<void> -
Removes multiple values by their keys in a single operation.
inherited
-
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.inherited -
setBytes(
String key, List< int> value) → Future<void> -
Saves a byte array with the given
key.override -
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.inherited -
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.override -
setInt(
String key, int value) → Future< void> -
Saves an int value with the given
key.inherited -
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.inherited -
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