AdGate class

The PERMISSION gate every controller consults: may this slot request (or keep serving) an ad right now?

  • canLoad/loadBlockReason: request configuration applied AND consent settled AND ads enabled (Remove-Ads off). Guards invariant 1 — no load() before consent — and the config-before-load ordering (review-fix #5 / ADR-028).
  • showBlockReason: the cheap live subset used on the show path.

Frequency caps and the full-screen coordinator are deliberately NOT here (3.0): they are SHOW-pacing concerns owned by the controllers, and the one composed query that mixed them in (canShow) was an unfixably racy footgun — see the note at the end of this file.

Constructors

AdGate({required Future<bool> canRequestAds(), required bool isEnabled(), Future<bool> settleRequestConfig()?, Future<void> settleConsent()?, int consentGeneration()?})
Creates a gate.

Properties

consentGeneration → int
A monotonically-increasing counter bumped on every consent MUTATION.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isEnabled → bool
The cheap, synchronous "are ads currently enabled?" answer (the injected isEnabled predicate: Remove-Ads off AND the owning graph still alive).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

canLoad(String slot) → Future<bool>
Whether slot may load an ad now.
loadBlockReason(String slot) → Future<AdBlockReason?>
Why slot may not load right now, or null if it may (ADR-045).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
showBlockReason(String slot) → Future<AdBlockReason?>
Why slot may not SHOW an already-loaded ad right now, or null if it may — the cheap, current checks only (2026-07 audit).
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited