fcmBackfillMaxAttempts property

int get fcmBackfillMaxAttempts

Persisted failed-attempt count bound for the one-time FCM backfill give-up (A.7/FCM-116). A permanently-failing already-broken install stops re-forcing a backfill persist — and stamps the one-way FCM-024 marker — only after failures pass BOTH this count AND a ~30-day time floor from the first recorded backfill attempt. This count+time hybrid keeps a transient outage or a few logout→login troubleshooting cycles from prematurely exhausting the bound and stamping the irreversible marker on a still-healable install. This is ADDITIVE to the immediate give-up on a classified permission-denied.

Can be set via:

  • Code: AppConfigBase.fcmBackfillMaxAttemptsDefault = 5
  • Build flag: --dart-define dreamic_fcm_backfill_max_attempts=5
  • Firebase Remote Config: dreamic_fcm_backfill_max_attempts

Default: 5 (bounds 1-20).

Implementation

static int get fcmBackfillMaxAttempts {
  const envValue = int.fromEnvironment(
    'dreamic_fcm_backfill_max_attempts',
    defaultValue: -1,
  );
  if (envValue != -1) {
    return envValue;
  } else {
    final remoteValue =
        g<RemoteConfigRepoInt>().getInt('dreamic_fcm_backfill_max_attempts');
    if (remoteValue > 0) {
      final bounds = configBounds['dreamic_fcm_backfill_max_attempts']!;
      return remoteValue.clamp(bounds.min, bounds.max);
    } else {
      return defaultRemoteConfig['dreamic_fcm_backfill_max_attempts'] as int;
    }
  }
}