syncSession property

Session syncSession

The Session for this Realm. The sync session is responsible for two-way synchronization with MongoDB Atlas. If the Realm is not synchronized, accessing this property will throw.


Session get syncSession {
  if (config is! FlexibleSyncConfiguration) {
    throw RealmError('session is only valid on synchronized Realms (i.e. opened with FlexibleSyncConfiguration)');

  var result = _syncSession?.target;

  if (result == null || result.handle.released) {
    result = SessionInternal.create(handle.getSession());
    _syncSession = WeakReference(result);

  return result;