notificationMaxAskCount property

int get notificationMaxAskCount

Maximum number of times to ask for notification permission after denials. After this many denials, the app will stop asking (until tracking is cleared).

Set to 0 to never ask again after any denial.

Can be set via:

  • Code: AppConfigBase.notificationMaxAskCountDefault = 5
  • Build flag: --dart-define notificationMaxAskCount=5
  • Firebase Remote Config: notificationMaxAskCount

Default: 3

Implementation

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