ZenStorage class abstract

Interface for persisting query data.

Implement this to enable offline support and hydration for ZenQuery.

Example with SharedPreferences:

class SharedPrefsStorage implements ZenStorage {
  @override
  Future<void> write(String key, Map<String, dynamic> json) async {
    final prefs = await SharedPreferences.getInstance();
    await prefs.setString(key, jsonEncode(json));
  }
  // ... implement read and delete
}

Constructors

ZenStorage()

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

delete(String key) Future<void>
Delete data from storage.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
read(String key) Future<Map<String, dynamic>?>
Read data from storage.
toString() String
A string representation of this object.
inherited
write(String key, Map<String, dynamic> json) Future<void>
Write data to storage.

Operators

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