networkConfirmationEnabled property

bool get networkConfirmationEnabled

Master kill-switch (BEH-17/NET-026) for the entire network confirm-before- flip layer: confirm-before-flip, generation-token supersession, adaptive cadence, the _lastStatus resync, the lifecycle resume re-probe, and the startup fast self-heal cadence. When false, dreamic reproduces full pre-hotfix connectivity behavior (immediate offline flip on the first failed probe, fixed connected-interval cadence, log-only lifecycle listener), so a field regression in the new logic can be neutralized from Remote Config without an app-store release.

Unlike appCheckEnabled/fcmAutoInitialize (dart-define only), this is the first RC-backed bool: it resolves env override → Remote Config → default, mirroring the int-knob shape (NET-026). Because Firebase RC's getBool returns false for BOTH an unset key and an explicitly-false key, the "is-set" detection uses the raw string (RC stores bools as "true"/"false"; unset is ""), then the typed value is read via getBool.

Can be set via:

  • Code: AppConfigBase.networkConfirmationEnabledDefault = false
  • Build flag: --dart-define dreamic_network_confirmation_enabled=false
  • Firebase Remote Config: dreamic_network_confirmation_enabled

Default: true

Implementation

static bool get networkConfirmationEnabled {
  const envValue = String.fromEnvironment('dreamic_network_confirmation_enabled');
  // Only an explicit 'true'/'false' dart-define wins. Any OTHER non-empty
  // value (a build-flag typo like `=1` or `=yes`) deliberately falls through
  // to the RC/default path rather than silently coercing to `false` — because
  // this knob is a safety kill-switch and a typo must not silently revert the
  // whole resilience layer to pre-hotfix behavior. This intentionally diverges
  // from the house `== 'true'` idiom (e.g. [lockOrientationToPortrait]) for
  // that reason (NET-026 kill-switch hardening).
  if (envValue == 'true') return true;
  if (envValue == 'false') return false;
  try {
    final rc = g<RemoteConfigRepoInt>();
    // Raw-string "is-set" detection (getBool cannot distinguish unset from
    // explicitly-false); read the typed value via getBool when set.
    final rawValue = rc.getString('dreamic_network_confirmation_enabled');
    if (rawValue.isNotEmpty) {
      return rc.getBool('dreamic_network_confirmation_enabled');
    } else {
      return defaultRemoteConfig['dreamic_network_confirmation_enabled'] as bool;
    }
  } catch (_) {
    // GetIt/RC not initialized (e.g., in tests or an early-boot read), use
    // default. Critically, the kill-switch defaults to ON (true) — the whole
    // resilience layer stays active even if this is read before RC registers.
    return defaultRemoteConfig['dreamic_network_confirmation_enabled'] as bool;
  }
}