AdGate constructor

AdGate({
  1. required Future<bool> canRequestAds(),
  2. required bool isEnabled(),
  3. Future<bool> settleRequestConfig()?,
  4. Future<void> settleConsent()?,
  5. int consentGeneration()?,
})

Creates a gate.

canRequestAds is the cheap, current consent answer (wire it to AdSdk.canRequestAds) — it must NOT re-run the consent flow. isEnabled reflects the app's Remove-Ads state. settleRequestConfig joins (and if needed re-attempts) the bounded updateRequestConfiguration apply and answers whether loads may proceed with respect to it — false blocks the load with AdBlockReason.requestConfigNotApplied (the fail-closed policy path, 4.0). It must be BOUNDED (the facade's attempts are) so the gate never parks a load indefinitely. Omit it when config timing is not in play.

Implementation

AdGate({
  required Future<bool> Function() canRequestAds,
  required bool Function() isEnabled,
  Future<bool> Function()? settleRequestConfig,
  Future<void> Function()? settleConsent,
  int Function()? consentGeneration,
}) : _canRequestAds = canRequestAds,
     _isEnabled = isEnabled,
     _settleRequestConfig = settleRequestConfig,
     _settleConsent = settleConsent,
     _consentGeneration = consentGeneration;