appCheckUseDebugProviders property

bool get appCheckUseDebugProviders

Whether App Check uses the DEBUG attestation providers instead of the real ones (Play Integrity / App Attest / reCAPTCHA).

Deliberately decoupled from kDebugMode: build mode and attestation target are different axes — a debug build may need real attestation (e.g. when run against staging). Resolution:

  1. --dart-define=APP_CHECK_DEBUG=true|false if provided, else
  2. derived — debug providers ONLY when the app is pointed at the Firebase emulator (doUseBackendEmulator, or environmentType == emulator); real attestation in every real-backend environment (development / test / staging / production). Enforcing real attestation against an emulated backend is pointless (the emulator bypasses App Check), so the emulator is the one environment that defaults to debug providers.

Implementation

static bool get appCheckUseDebugProviders {
  if (_appCheckUseDebugProviders == null) {
    const raw = String.fromEnvironment('APP_CHECK_DEBUG');
    if (raw.isNotEmpty) {
      _appCheckUseDebugProviders = raw == 'true';
    } else {
      _appCheckUseDebugProviders =
          doUseBackendEmulator || environmentType == EnvironmentType.emulator;
    }
  }
  return _appCheckUseDebugProviders!;
}