syncSession property Null safety

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)');

  _syncSession ??= SessionInternal.create(realmCore.realmGetSession(this));
  return _syncSession!;