InterstitialController class

Controller for interstitial ads with frequency capping.

Provides imperative control over interstitial ad loading and display. Use this directly when you need multiple interstitial ad placements, or use AdManager.showInterstitial for the simpler single-placement pattern.

final controller = InterstitialController(
  adUnitId: AdUnitId(
    android: 'ca-app-pub-xxxxx/interstitial-android',
    ios: 'ca-app-pub-xxxxx/interstitial-ios',
  ),
  frequencyCapSeconds: 120,
);

await controller.load();
final shown = await controller.show();
// ...
controller.dispose();

The controller automatically preloads the next ad after each show.

Constructors

InterstitialController({required AdUnitId adUnitId, int frequencyCapSeconds = 60, int maxRetryCount = 3, int retryBaseDelayMs = 1000, void onEvent(AdEvent)?})
Creates an interstitial controller.

Properties

adUnitId AdUnitId
The ad unit ID for this interstitial placement.
final
frequencyCap FrequencyCap
The frequency cap instance (exposed for testing).
no setter
frequencyCapSeconds int
Minimum seconds between consecutive impressions.
final
hashCode int
The hash code for this object.
no setterinherited
maxRetryCount int
Maximum number of retry attempts.
final
onEvent → void Function(AdEvent)?
Optional callback for ad lifecycle events.
final
retryBaseDelayMs int
Base delay for exponential backoff retry, in milliseconds.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state AdState
The current state of the interstitial ad.
no setter

Methods

dispose() → void
Releases resources held by this controller.
load() Future<void>
Preloads an interstitial ad.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
show() Future<bool>
Shows the preloaded interstitial ad.
toString() String
A string representation of this object.
inherited

Operators

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