FullScreenAdControllerBase class abstract
Shared engine for all full-screen formats (interstitial, rewarded, rewarded interstitial, app open).
Encodes the invariants once:
- consent/enabled gate before every load (invariant 1);
- retry with backoff, then cooldown, then auto re-arm (ADR-008);
- single-use handles: dispose on dismiss/fail and reload immediately so one ad is always warm (invariant 7, ADR-011);
FullScreenAdCoordinatorentered on show and exited on dismiss/fail, so no two full-screen ads ever overlap;- impressions recorded in the frequency caps when the ad shows.
- Implemented types
- Implementers
Constructors
- FullScreenAdControllerBase({required AdSdk sdk, required AdGate gate, required FrequencyCapPolicy caps, required FullScreenAdCoordinator coordinator, required String slot, required String adUnitId, Duration? maxAdAge, RetryPolicy? retry, void onPaid(AdPaidEvent event)?, void onBlocked(String slot, AdBlockReason reason)?, DateTime now()?})
-
Wires the shared engine.
slotnames this format for the gate/caps (e.g.'interstitial').adUnitIdis already platform-resolved.
Properties
- adUnitId → String
-
The platform-resolved ad unit ID this controller loads.
final
- canShow → bool
-
Whether show would show an ad right now: one is warm and unexpired, ads
are enabled, no other full-screen ad is on screen, and the frequency caps
and pacing allow it (6.0).
no setteroverride
- hashCode → int
-
The hash code for this object.
no setterinherited
- isExpired → bool
-
Whether the warm ad has outlived its maximum age and must not be shown.
no setter
- isReady → bool
-
Whether a loaded ad is warm and ready to show.
no setter
- lastBlockReason → AdBlockReason?
-
Why this slot last refused to load or show, or null if nothing is
blocking it (ADR-045). A gate-blocked load reports AdIdle, which is also
what "not requested yet" looks like — this is what tells them apart, and
it is the only way an app can learn that (say) a rewarded show was refused
by a frequency cap rather than by a missing ad.
no setter
- response → AdResponseSummary?
-
Which network filled the warm ad (mediation observability), or null
when nothing is loaded / the SDK reported nothing.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sdk → AdSdk
-
The seam, for subclasses' loadHandle implementations.
no setter
- slot → String
-
The gate/cap slot name of this format.
final
-
state
→ ValueListenable<
AdLoadState> -
Reactive load state (subscribe with
ValueListenableBuilder).no setteroverride
Methods
-
canShowExtra(
) → bool - Extra per-format show precondition (e.g. interstitial user-action pacing). Runs after the gate allows.
-
discardCurrentAd(
) → void - Drops the current handle (without showing it) and preloads a fresh one — for a warm ad that must not be shown: expired, requested under a or stale consent generation.
-
dispose(
) → void -
Cancels timers, disposes the current handle and stops the controller.
override
-
load(
) → Future< void> -
Loads an ad if the gate allows and none is loaded/loading.
override
-
loadHandle(
) → Future< FullScreenAdHandle> - The seam load call for this format.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
noteBlocked(
AdBlockReason reason) → void -
Records a refusal and notifies
AdFlow.onAdBlocked. -
onShown(
) → void - Hook invoked right after a show is dispatched.
-
recheckGate(
) → Future< void> -
Re-evaluates this slot against the current gate, right now, and repairs a
live/warm ad that no longer matches it.
override
-
retireInventory(
) → void - Retires this controller's inventory: cancels the timer, drops a warm (not-showing) handle, and makes load and every autonomous reload (dismiss/expiry/retry) a no-op for the rest of the process. A currently SHOWING ad finishes on screen — its dismiss cleans up but does not reload, because load is now inert. Idempotent; safe after dispose.
-
show(
) → Future< AdShowResult> -
Checks the gate, shows the warm ad, records the impression and
preloads the next one on dismissal.
override
-
showEngine(
{OnUserEarnedReward? onReward, Future< bool> confirm()?}) → Future<AdShowResult> -
The full show engine, shared by every format.
onRewardis forwarded to the handle for the rewarded formats (their publicshow(onReward:)overrides call this); the base show never passes one. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- presentationTimeout → const Duration
-
How long show waits for the SDK to put a dispatched ad ON SCREEN
before it completes with
AdShowResult.failed(kindtimeout), so an ad the SDK never presents cannot hold the app's flow forever. Once the ad is on screen there is no bound: show completes when the user closes it, however long that takes (a user may leave the app mid-video and finish it later — the result must still carry the reward). The ad itself is never touched: the controller keeps following the SDK's events.