serverpod_offline_sync_client library

Classes

AuthenticationKeyManager
Manages keys for authentication with the server.
BadRequestMessage
A message sent when a bad request is received.
BaseHlc
Base class for HLC timestamps.
Bit
Represents a binary vector, where each element is either true or false.
Caller
ClientAuthKeyProvider
Provides the authentication key for the client.
CloseMethodStreamCommand
A message sent over a websocket connection to close a websocket stream of data to an endpoint method.
ConnectivityMonitor
Keeps track of internet connectivity and notifies its listeners when the internet connection is either lost or regained. For most use cases, use the concrete FlutterConnectivityMonitor class in the serverpod_flutter package.
CrdtDataAttemptedValue
Authored field value retained while the domain column holds a projection.
CrdtDataAttemptedValueAttachRowRepository
CrdtDataAttemptedValueInclude
CrdtDataAttemptedValueIncludeList
CrdtDataAttemptedValueRepository
CrdtDataAttemptedValueTable
CrdtDataAttemptedValueUpdateTable
CrdtDatabase
Database proxy that runs insert/update/delete ORM operations inside a transaction to record each change in the CRDT tables.
CrdtDatabaseContext
Process-level CRDT database metadata shared by ephemeral database wrappers.
CrdtDatabaseSession
Wraps a DatabaseSession to provide a CrdtDatabase as DatabaseSession.db.
CrdtDataDeleted
CRDT visibility generation table.
CrdtDataDeletedAttachRowRepository
CrdtDataDeletedInclude
CrdtDataDeletedIncludeList
CrdtDataDeletedRepository
CrdtDataDeletedTable
CrdtDataDeletedUpdateTable
CrdtDataField
CRDT data table.
CrdtDataFieldAttachRowRepository
CrdtDataFieldInclude
CrdtDataFieldIncludeList
CrdtDataFieldRepository
CrdtDataFieldTable
CrdtDataFieldUpdateTable
CrdtDataRow
CRDT data rows table.
CrdtDataRowAttachRepository
CrdtDataRowAttachRowRepository
CrdtDataRowInclude
CrdtDataRowIncludeList
CrdtDataRowRepository
CrdtDataRowTable
CrdtDataRowUpdateTable
CrdtMergeChange
A remote CRDT change to merge.
CrdtMergeDelete
A remote visibility CLFlag update to merge.
CrdtMergeInsert
A remote row insertion to merge.
CrdtMergeUpdate
A remote field update to merge.
CrdtMutationRecorder
Persists additional CRDT rows after a mutating ORM operation completes.
CrdtNode
CRDT nodes table.
CrdtNodeInclude
CrdtNodeIncludeList
CrdtNodeRepository
CrdtNodeTable
CrdtNodeUpdateTable
CrdtSchemaColumn
CRDT schema columns table.
CrdtSchemaColumnAttachRowRepository
CrdtSchemaColumnInclude
CrdtSchemaColumnIncludeList
CrdtSchemaColumnRepository
CrdtSchemaColumnTable
CrdtSchemaColumnUpdateTable
CrdtSchemaRegistry
Manages the CRDT schema for a database.
CrdtSchemaTable
CRDT schema tables table.
CrdtSchemaTableInclude
CrdtSchemaTableIncludeList
CrdtSchemaTableRepository
CrdtSchemaTableTable
CrdtSchemaTableUpdateTable
CrdtScope
CRDT scopes table.
CrdtScopeAttachRepository
CrdtScopeAttachRowRepository
CrdtScopeDetachRowRepository
CrdtScopeGrant
A single scope a peer announces in a CrdtSyncScopeSet.
CrdtScopeInclude
CrdtScopeIncludeList
CrdtScopeManager
A manager for CrdtScope instances.
CrdtScopeMember
Authorization membership for shared CRDT scopes.
CrdtScopeMemberAttachRowRepository
CrdtScopeMemberInclude
CrdtScopeMemberIncludeList
CrdtScopeMemberRepository
CrdtScopeMembership
Resolves shared-scope membership from the crdt_scope_members table.
CrdtScopeMemberTable
CrdtScopeMemberUpdateTable
CrdtScopeNode
A CRDT node's participation and checkpoint state within one scope.
CrdtScopeNodeAttachRowRepository
CrdtScopeNodeInclude
CrdtScopeNodeIncludeList
CrdtScopeNodeRepository
CrdtScopeNodeTable
CrdtScopeNodeUpdateTable
CrdtScopeRepository
CrdtScopeTable
CrdtScopeUpdateTable
CrdtSync
The shared CRDT synchronization logic used by both client and server nodes.
CrdtSyncClient
High-level client sync helpers built on top of a CRDT stream transport.
CrdtSyncClose
Marks a graceful end of a one-shot sync session.
CrdtSyncConnect
Session handshake sent once by each peer before any scope work.
CrdtSyncCycleBatch
One sync cycle's inbound frames.
CrdtSyncEndOfBatch
Marks the end of a framed sync batch.
CrdtSyncIdleTimeout
Marks a timeout of an idle sync session.
CrdtSyncIntegrityViolation
Durable record of a terminal CRDT sync integrity violation.
CrdtSyncIntegrityViolationInclude
CrdtSyncIntegrityViolationIncludeList
CrdtSyncIntegrityViolationRepository
CrdtSyncIntegrityViolationTable
CrdtSyncIntegrityViolationUpdateTable
CrdtSyncMergeChunk
A chunk of merge changes carried inside a framed sync batch.
CrdtSyncScopeSet
Authoritative or informational scope set exchanged at the start of a cycle.
CrdtSyncSession
A running continuous CRDT sync session.
CrdtSyncSinceHlc
Per-scope checkpoint sent by each peer before the first visit to a scope.
CrdtSyncStreamEvent
A CRDT sync event sent over a bidirectional stream.
CrossTabLock
A mutual-exclusion lock shared across cooperating execution contexts that hold the same credentials, such as browser tabs of one origin.
DeepCollectionEquality
Deep equality on collections.
EndpointCaller
Super class for all classes that can call a server endpoint.
EndpointCrdtSync Endpoint
Endpoint for CRDT-based offline-first synchronization.
EndpointRef
This class connects endpoints on the server with the client, it also hooks up streams with the endpoint. Overridden by generated code.
FileUploader
The file uploader uploads files to Serverpod's cloud storage. On the server you can setup a custom storage service, such as S3 or Google Cloud. To directly upload a file, you first need to retrieve an upload description from your server. After the file is uploaded, make sure to notify the server by calling verifyUpload on the current Session object.
Geography
Abstract base class for all PostGIS geography types.
GeographyGeometryCollection
Represents a PostGIS GeometryCollection — a heterogeneous collection of Geography values (points, line strings, polygons).
GeographyLineString
Represents a geographic line string (sequence of points) for use with PostGIS.
GeographyPoint
Represents a geographic point with longitude, latitude, and spatial reference system identifier (SRID) for use with PostGIS.
GeographyPolygon
Represents a geographic polygon (exterior ring + optional holes) for PostGIS.
HalfVector
Represents a vector of half-precision float values.
Hlc
A Hybrid Logical Clock implementation that supports both ISO 8601 and Unix timestamp formats. The datetime component has millisecond precision and is always stored in UTC.
HlcManager
A manager for Hlc instances that is used to generate unique timestamps for CRDT operations.
MethodCallContext
Context for a method call.
MethodStreamMessage
A message sent to a method stream.
MethodStreamSerializableException
A serializable exception sent over a method stream.
ModuleEndpointCaller
This class is used to connect modules with the client. Overridden by generated code.
MutexRefresherClientAuthKeyProvider
A RefresherClientAuthKeyProvider decorator that adds a mutex lock to prevent concurrent refresh calls. Actual auth header getter and refresh logic is delegated to the _delegate provider.
OpenMethodStreamCommand
A message sent over a websocket connection to open a websocket stream of data to an endpoint method.
OpenMethodStreamResponse
A message sent over a websocket connection to respond to an OpenMethodStreamCommand.
PingCommand
A message sent over a websocket connection to check if the connection is still alive. The other end should respond with a PongCommand.
PongCommand
A response to a PingCommand.
Protocol
ProtocolSerialization
The ProtocolSerialization defines a toJsonForProtocol method which makes it possible to limit what fields are serialized when communicating over the protocol.
RefresherClientAuthKeyProvider
Provides the authentication key for the client, with a method to refresh it.
SerializableModel
The SerializableModel is the base interface for all serializable objects in Serverpod, except primitives.
SerializationManager
The SerializationManager is responsible for creating objects from a serialization, but also for serializing objects. This class is typically extended by generated code.
ServerpodClientRequestDelegate
Defines the interface of the delegate that performs the actual request to the server and returns the response data. The delegate is used by ServerpodClientShared to perform the actual request. It's overridden in different versions depending on if the dart:io library is available.
ServerpodClientShared
Superclass with shared methods for handling communication with the server. Is typically overridden by generated code to provide implementations of methods for calling the server.
SparseVector
Represents a sparse vector that stores only non-zero elements.
Uuid
uuid for Dart Author: Yulian Kuncheff Released under MIT License.
UuidValue
Vector
Represents a vector of double values.
WebSocketMessage
Base class for messages sent over a WebSocket connection.
WebSocketMessageInfo
Interface of WebSocketMessage subclasses that have endpoint, method and connection id info.

Enums

CloseReason
The reason a stream was closed.
CrdtDataDeletedReason
Why a synced user tombstone changed row visibility.
CrdtDataRowVisibility
Materialized visibility state for a CRDT row.
CrdtProjectionReason
Why a domain column currently differs from its authored value.
CrdtScopeRole
CRDT access role for a member of a shared scope.
CrdtSyncPeerMode
How a peer decides which scopes it syncs.
CrdtSyncViolationOperation
Merge or sync operation that observed an integrity violation.
CrdtSyncViolationType
High-level category of a durable CRDT sync integrity violation.
Namespace
RFC4122 & RFC9562 provided namespaces for v3, v5, and v8 namespace based UUIDs
OpenMethodStreamResponseType
The response to an OpenMethodStreamCommand.
RefreshAuthKeyResult
Represents the result of an authentication key refresh operation.
ValidationMode
The options for UUID Validation strictness

Mixins

CookieAuthTransport
The cookie-auth capability of a ServerpodClientRequestDelegate.

Extensions

Base64Dec on String
Extension for decoding ByteData in protocol.
Base64Enc on ByteData
Extension for encoding ByteData in the protocol.
BaseHlcToHlc on BaseHlc
Extensions for BaseHlc to convert it to an Hlc.
BigIntJsonExtension on BigInt
Expose toJson on BigInt Expose static fromJson builder
BitJsonExtension on Bit
Expose toJson on Bit
BoolJsonExtension on bool
Expose static fromJson builder for bool that handles bool or int values. Required to handle SQL boolean values that are stored as 0 or 1.
ByteDataJsonExtension on ByteData
Expose toJson on ByteData Expose static fromJson builder
CloneBit on Bit
Adds clone method that create a deep copy of a Bit vector.
CloneByteData on ByteData
Adds clone method that create a deep copy of a ByteData.
CloneHalfVector on HalfVector
Adds clone method that create a deep copy of a HalfVector.
CloneSparseVector on SparseVector
Adds clone method that create a deep copy of a SparseVector.
CloneVector on Vector
Adds clone method that create a deep copy of a ByteData.
CrdtDatabaseAccess on DatabaseSession
Convenience access to a CRDT-aware database from a wrapped session.
CrdtDataDeletedExtension on CrdtDataDeleted
Extensions for the CrdtDataDeleted class.
CrdtDataDeletedReasonExtension on CrdtDataDeletedReason
Extensions for the CrdtDataDeletedReason enum.
CrdtDataFieldExtension on CrdtDataField
Extensions for the CrdtDataField class.
CrdtDataRowExtension on CrdtDataRow
Extensions for the CrdtDataRow class.
CrdtDataRowVisibilityExtension on CrdtDataRowVisibility
Extensions for the CrdtDataRowVisibility enum.
CrdtMergeChangeExtension on CrdtMergeChange
Convenience helpers shared by every merge change.
CrdtMergeChangeStreamExtension on Stream<CrdtMergeChange>
Helpers for grouping merge changes into stream payload batches.
CrdtMergeInsertExtension on CrdtMergeInsert
Convenience helpers for insert changes.
CrdtMergeRecorderExtension on CrdtMutationRecorder
Adds merge-specific behavior to CrdtMutationRecorder.
CrdtMergeSetExtension on CrdtMergeSet
CRDT merge helpers for CrdtMergeSet.
CrdtScopeRoleWriteAccess on CrdtScopeRole?
CRDT write capability for a scope role.
CrdtSyncClientExtension on ServerpodClientShared
Exposes CRDT sync helpers from a generated client.
CrdtSyncStreamEventStreamExtension on StreamIterator<CrdtSyncStreamEvent>
Extensions for stream iterators of CrdtSyncStreamEvent.
DateTimeJsonExtension on DateTime
Expose toJson on DateTime Expose static fromJson builder
DurationJsonExtension on Duration
Expose toJson on Duration Expose static fromJson builder
GeographyGeometryCollectionJsonExtension on GeographyGeometryCollection
Expose toJson on GeographyGeometryCollection and a static fromJson builder.
GeographyLineStringJsonExtension on GeographyLineString
Expose toJson on GeographyLineString and a static fromJson builder.
GeographyPointJsonExtension on GeographyPoint
Expose toJson on GeographyPoint and a static fromJson builder.
GeographyPolygonJsonExtension on GeographyPolygon
Expose toJson on GeographyPolygon and a static fromJson builder.
HalfVectorJsonExtension on HalfVector
Expose toJson on HalfVector
HlcMax on Iterable<Hlc>
Extensions for an Iterable of Hlc.
IncludeTombstonedRows on Table
Extension on Table that exposes includeHiddenRows for use in where clauses to bypass the CRDT tombstone/visibility filter.
ListJsonExtension on List<T>
Expose toJson on List
MapJsonExtension on Map<K, V>
Expose toJson on Map
ScopeUuidFilter on Table
Extension on Table that exposes scopeEquals for use in where clauses to restrict membership-wide reads to a single scope.
ServerpodClientCookieAuth on ServerpodClientShared
Browser-managed cookie auth transport for a ServerpodClientShared.
SetJsonExtension on Set<T>
Expose toJson on Set
SparseVectorJsonExtension on SparseVector
Expose toJson on SparseVector
UriJsonExtension on Uri
Expose toJson on Uri Expose static fromJson builder
UuidValueJsonExtension on UuidValue
Expose toJson on UuidValue Expose static fromJson builder
VectorJsonExtension on Vector
Expose toJson on Vector

Constants

autoSerializedTypes → const List<String>
All datatypes that are serialized by default. Used internally in Serverpod code generation.
basicAuthSchemeName → const String
The name of the default Serverpod scheme for HTTP "authorization" headers. Note, the scheme name is case-insensitive and should be compared in a case-insensitive manner.
bearerAuthSchemeName → const String
The name of the Bearer scheme for HTTP "authorization" headers. Note, the scheme name is case-insensitive and should be compared in a case-insensitive manner.
extensionSerializedTypes → const List<String>
All datatypes that has extensions to support serialization. Used internally in Serverpod code generation.
hasCloneExtensionTypes → const List<String>
List of types that has a clone method extension and therefore can be copied by calling clone().
immutable → const Immutable
Annotation on an immutable class.
useResult → const UseResult
Annotation on function or property whose value must not be ignored.
webAuthModeCookie → const String
The webAuthModeHeaderName value that selects cookie-based web auth.
webAuthModeCookieTransport → const String
The webAuthModeHeaderName value for cookie transport without authentication: cookies are still carried and may be set (sign-in, JWT refresh), but the main auth cookie must not authenticate the call. Sent by cookie-mode clients for @unauthenticatedClientCall methods.
webAuthModeHeaderName → const String
The request header a web client sets to ask the server to issue the auth token as an HttpOnly cookie (in Set-Cookie).
webBasePathHeaderName → const String
The request header a cookie-mode web client sets to declare the browser-visible base path of the server: the path component of the client's host, e.g. /api behind a prefix-stripping reverse proxy, or /.

Properties

crdtRowLastVisibleVisibilityIndex int
Last serialized index that still represents a visible CRDT row.
final
nonMutableTypeNames List<String>
List of types that are not mutable and therefore do not need to be copied or handled in a copyWith method.
final
scopeForTransaction Map<Transaction, CrdtScope>
Map of transaction hashes to the scope they are associated with.
final
userForTransaction Map<Transaction, UuidValue>
Map of transaction hashes to the authenticated user associated with them.
final

Functions

getType<T>() Type
Get the type provided as an generic. Useful for getting a nullable type.
isValidAuthHeaderValue(String value) bool
Returns true if the provided value is a valid HTTP "authorization" header value (which includes starting with an authentication scheme name).
isWrappedBasicAuthHeaderValue(String value) bool
Returns true if the provided value is a Serverpod-wrapped auth key.
isWrappedBearerAuthHeaderValue(String value) bool
Returns true if the provided value is a Bearer auth header value.
unwrapAuthHeaderValue(String? authValue) String?
Returns the auth key from an auth value that has potentially been wrapped. This operation is the inverse of wrapAsBasicAuthHeaderValue and wrapAsBearerAuthHeaderValue. If null is provided, null is returned.
wrapAsBasicAuthHeaderValue(String key) String
Returns a value that is compliant with the HTTP auth header format by encoding and wrapping the provided auth key as a Basic auth value.
wrapAsBearerAuthHeaderValue(String token) String
Returns a value that is compliant with the HTTP auth header format by wrapping the provided token as a Bearer auth value. Unlike Basic auth, Bearer tokens are not Base64 encoded as they are expected to already be in the correct format.

Typedefs

ConnectivityMonitorListener = void Function(bool connected)
Callback for when internet connectivity changes.
CrdtMergeMetadataLookup = ({Map<String, Set<String>> columnNamesByTable, Map<String, Set<UuidValue>> rowIdsByTable})
Merge metadata extracted from a CrdtMergeSet.
CrdtMergeSet = List<CrdtMergeChange>
A group of CRDT merge changes collected for one sync batch.
CrdtSyncOnMergeSuccess = FutureOr<void> Function(UuidValue scopeUuid, Hlc syncedHlc)
Callback function for when a merge is successful.
CrdtSyncTransport = Stream<CrdtSyncStreamEvent> Function({required Stream<CrdtSyncStreamEvent> changes, required bool once})
Opens the remote half of a CRDT sync stream.
DomainRowOwner = ({bool exists, int? scopeId})
A tuple representing the ownership of a domain row.
DomainRowOwnerCache = Map<(String, UuidValue), DomainRowOwner>
A cache of domain row owners by table name and row id.
VoidCallback = void Function()
A callback with no parameters or return value.

Exceptions / Errors

AuthHeaderEncodingException
An exception thrown upon erroneous encoding of an auth header.
ClockDriftException
Exception thrown when the clock drift exceeds the maximum allowed.
ConnectionAttemptTimedOutException
Thrown if connection attempt timed out.
ConnectionClosedException
Thrown if the connection is closed with an error.
CrdtSchemaReconciliationException
Thrown when CRDT schema reconciliation cannot be applied safely.
CrdtScopeMembershipException
Thrown when a user attempts to act in a scope they are not a member of.
CrdtScopeRoleException
Thrown when a user attempts to write in a scope with a non-writable role.
CrdtSyncException
Base type for CRDT sync session failures.
CrdtSyncIntegrityViolationException
Thrown when sync observes terminal CRDT metadata/domain-row inconsistency.
CrdtSyncStreamClosedException
Thrown when the inbound sync stream closes before an expected event arrives.
CrdtSyncUnexpectedEventException<T extends CrdtSyncStreamEvent>
Thrown when the inbound sync stream delivers an event of the wrong type.
DeserializationClassNameNotFoundException
Exception thrown when no deserialization handler exists for a class name.
DeserializationTypeNotFoundException
Exception thrown when no deserialization type was found during protocol deserialization
DuplicateNodeException
Exception thrown when a duplicate node is detected.
MethodStreamException
Exceptions thrown by the ClientMethodStreamManager.
MethodStreamIdleTimeoutException
Thrown if the method stream connection is idle for too long.
OpenMethodStreamException
Thrown if opening a method stream fails.
OverflowException
Exception thrown when the timestamp counter overflows.
SerializableException
This is SerializableException that can be used to pass Domain exceptions from the Server to the Client
ServerpodClientBadRequest
Thrown if the client created a malformed or invalid request to the server.
ServerpodClientEndpointNotFound
Thrown if the client tries to call an endpoint that was not generated. This will typically happen if getting the endpoint by type while the user has not defined the endpoint in their project.
ServerpodClientException
Exception thrown when errors in communication with the server occurs.
ServerpodClientForbidden
Thrown if the client is forbidden to perform the request. This is typically due to missing permissions.
ServerpodClientGetEndpointException
Thrown if not able to get an endpoint on the client by type.
ServerpodClientHttpException
Exception thrown when HTTP errors occur in communication with the server.
ServerpodClientInternalServerError
Thrown if the server encountered an internal error. This is typically a bug in the server code.
ServerpodClientMultipleEndpointsFound
Thrown if the client tries to call an endpoint by type, but multiple endpoints of that type exists. The user should disambiguate by using the name parameter.
ServerpodClientNetworkException
Exception thrown when a network error occurs.
ServerpodClientNotFound
Thrown if the requested resource was not found on the server.
ServerpodClientUnauthorized
Thrown if the client fails to authenticate and is therefore not authorized to perform the request.
ServerpodClientUnknownException
Exception thrown when an unknown error occurs.
ServerpodClientUnknownHttpException
Thrown if the server responded with an HTTP status code that the client has no dedicated exception for.
SyncTablesHashMismatchException
Thrown when the sync tables hash sent by a peer does not match locally.
UnknownMessageException
Exception thrown when an unknown message is received.
WebSocketClosedException
Thrown if the WebSocket connection is closed.
WebSocketConnectException
Thrown if the WebSocket connection fails.
WebSocketListenException
Thrown if an error occurs when listening to the WebSocket connection.