DVOfflineStore class

A model's local store and mutation log.

Reads and writes go to the local store whether or not the device is connected; writes are also appended to the log, and replay sends them to the server in the order they were made.

Constructors

DVOfflineStore({required DVRecordTable table, required DVOffline policy, DVOfflineClock? clock, bool? persistent, void onAdopted(DVRecord record)?})

Properties

clock → DVOfflineClock
final
hashCode → int
The hash code for this object.
no setterinherited
logTable → String
no setter
onAdopted → void Function(DVRecord record)?
Called when replay replaces this device's copy of a record with the server's, because the server kept something other than what the device wrote. The generated model publishes it, so a watcher sees the value that is now true rather than the one that was discarded.
final
persistent → bool
Whether the local store survives the application closing. A memory adapter does not, and says so (DV-OFFLINE-001).
final
policy → DVOffline
final
reported → List<String>
Codes reported this session, in order.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serverTable → String
The server's record for each key as this device last saw it.
no setter
table → DVRecordTable
The local store.
final

Methods

adoptServer(DVRecord record) → Future<void>
Takes the server's record as this device's copy and as the base its next writes are checked against.
all() → Future<List<DVRecord>>
clear() → Future<void>
Empties the local store and the log, as signing out does.
delete(Object id) → Future<void>
Deletes locally and queues the delete for the server.
ensureSchema() → Future<void>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pending() → Future<List<DVMutation>>
Writes waiting to reach the server, oldest first.
read(Object id) → Future<DVRecord?>
rejected() → Future<List<DVMutation>>
Writes the server refused permanently.
replay(DVOfflineRemote remote) → Future<DVReplayResult>
Sends queued mutations to remote, in order.
syncStateOf(Object id) → DVSyncState
toString() → String
A string representation of this object.
inherited
watchSyncState(Object id) → Stream<DVSyncState>
Each change to id's sync state.
write(Map<String, Object?> values) → Future<DVRecord>
Stores values locally and queues them for the server.

Operators

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