RewardedController class

Controller for rewarded ads.

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

final controller = RewardedController(
  adUnitId: AdUnitId(
    android: 'ca-app-pub-xxxxx/rewarded-android',
    ios: 'ca-app-pub-xxxxx/rewarded-ios',
  ),
);

await controller.load();
final reward = await controller.show();
if (reward != null) {
  gameState.addCoins(reward.amount);
}
controller.dispose();

Constructors

RewardedController({required AdUnitId adUnitId, int maxRetryCount = 3, int retryBaseDelayMs = 1000, void onEvent(AdEvent)?})
Creates a rewarded ad controller.

Properties

adUnitId AdUnitId
The ad unit ID for this rewarded placement.
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 rewarded ad.
no setter

Methods

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

Operators

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