FileSyncStateStore class

Dart VM / server file-backed SyncStateStore that persists the state to a JSON file. The file is created lazily on the first write.

Format:

{
"clientId": "client-",
"watermark": 42
}
Implemented types

Constructors

FileSyncStateStore(String path)
Creates a file-backed SyncStateStore. The path is the full path to the JSON file (use path_provider.getApplicationDocumentsDirectory on Flutter, or just a path like ~/.myapp/sync_state.json on the Dart VM).

Properties

hashCode int
The hash code for this object.
no setterinherited
path String
Full path to the JSON file.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

clearAsync() Future<void>
Clears all state (for tests or for the user to reset their identity).
override
getClientIdAsync() Future<String?>
Returns the persisted clientId, or null if this is a first run.
override
getWatermarkAsync() Future<int>
Returns the persisted watermark, or 0 if none.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setClientIdAsync(String clientId) Future<void>
Persists clientId for future reads.
override
setWatermarkAsync(int watermark) Future<void>
Persists watermark for future reads.
override
toString() String
A string representation of this object.
inherited

Operators

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