isOfflineEnabled static method

bool isOfflineEnabled()

Offline: whether offline messaging is actually running right now.

Integrators use it to branch offline-only behaviour — e.g. the composer detaches a durable upload batch on a conversation switch instead of destroying it (offline-uploads-spec OU-13), while offline-off keeps today's clear-on-switch behaviour.

Behaviour change (kill switch, BEH-AUTH-11). This used to report the init-time AppSettings.offlineConfig flag alone, so it answered true before login, after logout and while the layer could not run. It now answers true only when all of these hold:

  • the integrator enabled offline in AppSettings;
  • the server's offline kill switch is on;
  • a start has finished for the logged-in user and has not been superseded.

So it is false before login, after logout, while the switch is off, while encryption cannot run (dormant, BEH-ENC-06), across a settings restart, and for the whole of an in-flight start. It is true in the plaintext-fallback case, which is a running layer.

It is true before loginSuccess and before the realtime connection starts on login, and before onSuccess on relaunch.

Reads main-isolate fields synchronously with no await, so two reads in the same event-loop turn always agree. SDK state is isolate-local, so another isolate cannot observe or change it.

Implementation

static bool isOfflineEnabled() =>
    _offlineEnabledOverride ?? OfflineRuntime.instance.effectiveEnabled;