StorageAdapter class abstract interface

Low-level key/value storage contract for Qora persistence.

Implementations store raw JSON strings keyed by a stable string derived from the query key. The serialisation envelope — TTL, type discriminator, data — is managed entirely by PersistQoraClient; adapters only handle opaque strings and need no knowledge of Qora internals.

Available adapters

Package Backend
qora (built-in) InMemoryStorageAdapter
qora_storage_hive Hive
qora_storage_isar Isar
qora_storage_drift Drift / SQLite
qora_storage_shared_prefs SharedPreferences

Implementing a custom adapter

class MyAdapter implements StorageAdapter {
  @override
  Future<void> init() async { /* open DB, load file, etc. */ }

  @override
  Future<String?> read(String key) async => /* … */;

  @override
  Future<void> write(String key, String value) async { /* … */ }

  @override
  Future<void> delete(String key) async { /* … */ }

  @override
  Future<List<String>> keys() async => /* … */;

  @override
  Future<void> clear() async { /* … */ }

  @override
  Future<void> dispose() async { /* release resources */ }
}
Implementers

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() Future<void>
Removes all entries from the store.
delete(String key) Future<void>
Removes the entry for key. No-op if the key does not exist.
dispose() Future<void>
Releases any resources held by this adapter (open file handles, database connections, etc.).
init() Future<void>
Initialise the underlying storage backend.
keys() Future<List<String>>
Returns all keys currently held in the store.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(String key) Future<String?>
Returns the raw value stored under key, or null if absent.
toString() String
A string representation of this object.
inherited
write(String key, String value) Future<void>
Persists value under key, overwriting any previous value.

Operators

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