RestSyncProvider class

+: an HTTP + JSON SyncProvider backed by the high-level HttpClient interface.

  • POST $baseUrl/sync with the JSON-encoded envelope as the body. The response body should be a JSON-encoded SyncEnvelope.
  • GET $baseUrl/sync/watermark. The response body should be a plain int (as a String).

Both methods set Content-Type: application/json on the request.

Implemented types

Constructors

RestSyncProvider({required String baseUrl, HttpClient? client, Map<String, String>? headers, Duration? timeout})
Creates a REST-backed sync provider.

Properties

baseUrl → String
The base URL (e.g. https://api.example.com).
final
client → HttpClient
Exposes the underlying HttpClient (useful for tests, observability, or for wrapping the provider itself in another SyncProvider).
no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → Future<void>
+: closes the underlying HTTP client. Call from dispose.
currentWatermarkAsync() → Future<int>
Returns the current server-side watermark (e.g. the latest version of any change). The user can use this to bootstrap the local watermark.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
syncAsync(SyncEnvelope envelope) → Future<SyncEnvelope>
Receives the local envelope and returns the remote envelope (the changes that have happened on the server since envelope.since).
override
toString() → String
A string representation of this object.
inherited

Operators

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