StorageOperationsApi class abstract interface

Defines the interface for basic storage operations.

This interface provides a contract for performing CRUD (Create, Read, Update, Delete) operations on primitive data types and simple data structures such as strings, integers, doubles, booleans, lists, and JSON objects.

All storage operations are asynchronous and return Future values. Keys must be valid.

Implementers

Properties

hashCode int
The hash code for this object.
no setterinherited
isEmpty Future<bool>
Returns true if the storage contains no key-value pairs.
no setter
isNotEmpty Future<bool>
Returns true if the storage contains one or more key-value pairs.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clear() Future<void>
Removes all values from the storage.
close() Future<void>
Closes the storage and releases any associated resources.
containsKey(String key) Future<bool>
Returns true if a value with the given key exists in the storage.
get<E extends Object>(String key, {List<Enum>? enumValues}) Future<E?>
Retrieves a value of type E by its key.
getAll(Set<String> allowList) Future<Map<String, dynamic>>
Retrieves all key-value pairs from the storage.
getBool(String key) Future<bool?>
Retrieves a bool value by its key.
getBytes(String key) Future<Uint8List?>
Retrieves a byte array by its key.
getDateTime(String key, {bool isUtc = false}) Future<DateTime?>
Retrieves a DateTime value by its key.
getDouble(String key) Future<double?>
Retrieves a double value by its key.
getDuration(String key) Future<Duration?>
Retrieves a Duration value by its key.
getEnum<E extends Enum>(String key, List<E> values) Future<E?>
Retrieves an enum value of type E by its key.
getInt(String key) Future<int?>
Retrieves an int value by its key.
getJson(String key) Future<Map<String, dynamic>?>
Retrieves a JSON object by its key.
getJsonList(String key) Future<List<Map<String, dynamic>>?>
Retrieves a list of JSON objects by its key.
getKeys() Future<Set<String>>
Returns a set of all keys currently stored in the storage.
getString(String key) Future<String?>
Retrieves a String value by its key.
getStringList(String key) Future<List<String>?>
Retrieves a list of strings by its key.
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.
removeAll(Iterable<String> keys) Future<void>
Removes multiple values by their keys in a single operation.
set<E extends Object>(String key, E value) Future<void>
Saves a value of type E with the given key.
setAll(Map<String, dynamic> values) Future<void>
Saves multiple key-value pairs from a Map in a single operation.
setBool(String key, bool value) Future<void>
Saves a bool value with the given key.
setBytes(String key, Uint8List bytes) Future<void>
Saves a byte array with the given key.
setDateTime(String key, DateTime value) Future<void>
Saves a DateTime value with the given key.
setDouble(String key, double value) Future<void>
Saves a double value with the given key.
setDuration(String key, Duration value) Future<void>
Saves a Duration value with the given key.
setEnum<E extends Enum>(String key, E value) Future<void>
Saves an enum value of type E with the given key.
setInt(String key, int value) Future<void>
Saves an int value with the given key.
setJson(String key, Map<String, dynamic> value) Future<void>
Saves a JSON object (Map) with the given key.
setJsonList(String key, List<Map<String, dynamic>> value) Future<void>
Saves a list of JSON objects with the given key.
setString(String key, String value) Future<void>
Saves a String value with the given key.
setStringList(String key, List<String> value) Future<void>
Saves a list of strings with the given key.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited