Store contract for loading and optional key resolution and writes.
| Member / type / return | Meaning |
|---|---|
FutureOr<TxLoadResult<T>> load(TxLoadOptions<T> options) | Loads using the supplied options; DataSource uses current query state without arguments. Errors propagate. |
bool get canInsert | Whether the store supports Insert. |
bool get canUpdate | Whether the store supports Update. |
bool get canRemove | Whether the store supports Remove. |
bool get canByKey | Whether the store supports ByKey. |
FutureOr<T?> byKey(Object key) | Reads a record by key; missing keys return undefined (Vue) or null (Dart). |
FutureOr<T> insert(T item) | Inserts a record with a unique key and returns it. |
FutureOr<T> update(Object key, T Function(T) change) | Updates a notification or record. |
FutureOr<void> remove(Object key) | Removes the record or recursively removes a file/directory tree. |
import 'package:tecexpress/tecexpress.dart';
Future<void> example() async {
TxStore<int> store = TxArrayStore([1, 2], keyOf: (v) => v);
print(await store.load(const TxLoadOptions()));
}