Session class Sync

An object encapsulating a synchronization session. Sessions represent the communication between the client (and a local Realm file on disk), and the server. Sessions are always created by the SDK and vended out through various APIs. The lifespans of sessions associated with Realms are managed automatically.

Implemented types


connectionState ConnectionState
The session’s current connection state. This is the physical state of the connection and is different from the session's logical state, which is returned by state.
connectionStateChanges Stream<ConnectionStateChange>
Gets a Stream of ConnectionState that can be used to be notified whenever the connection state changes.
hashCode int
The hash code for this object.
realmPath String
The on-disk path of the file backing the Realm this Session represents
runtimeType Type
A representation of the runtime type of the object.
state SessionState
The session’s current state. This is different from connectionState since a session may be active, even if the connection is disconnected (e.g. due to the device being offline).
user User
The User that owns the Realm this Session is synchronizing.


getProgressStream(ProgressDirection direction, ProgressMode mode) Stream<SyncProgress>
Gets a Stream of SyncProgress that can be used to track upload or download progress.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
pause() → void
Pauses any synchronization with the server until the Realm is re-opened again after fully closing it or resume is called.
resume() → void
Attempts to resume the session and enable synchronization with the server. All sessions are active by default and calling this method is only necessary if pause was called previously.
toString() String
A string representation of this object.
waitForDownload([CancellationToken? cancellationToken]) Future<void>
Waits for the Session to finish all pending downloads.
waitForUpload() Future<void>
Waits for the Session to finish all pending uploads.


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