RewardedAdEvent enum
The events a RewardedAd can receive. Listen
to the events using rewardedAd.onEvent.listen((event) {})
.
Avaiable events:
- loading (When the ad starts loading)
- loaded (When the ad is loaded)
- loadFailed (When the ad failed to load)
- showed (When the ad is opened)
- showFailed (When the ad failed to show)
- earnedReward (When the user earns a reward)
For more info on rewarded ad events, read the documentation
Constructors
- RewardedAdEvent()
-
const
Values
- loadFailed → const RewardedAdEvent
-
Called when the ad failed to load. This event is usually thrown by
ad.load()
Warning: Attempting to load a new ad when the load fail is strongly discouraged. If you must load an ad when it fails, limit ad load retries to avoid continuous failed ad requests in situations such as limited network connectivity.
You can check the reason like this
rewardedAd.onEvent.listen((e) { final event = e.keys.first; switch (event) { case RewardedAdEvent.loadFailed: final error = e.values.first; print('load failed ${error.code}'); break; default: break; } });
For more info, read the documentation
- loaded → const RewardedAdEvent
-
Called when an ad is loaded. This event is usually thrown by
ad.load()
You can also check if the ad is loaded by calling
ad.isLoaded
. If it's not loaded, you can load a new ad by callingad.load()
For more info, read the documentation
- loading → const RewardedAdEvent
-
Called when the ad starts loading. This event is usually thrown by
ad.load()
For more info, read the documentation
- showed → const RewardedAdEvent
-
Called when the ad showed. This event is usually thrown by
ad.show()
For more info, read the documentation
- showFailed → const RewardedAdEvent
-
Called when the ad failed to show. This event is usually thrown by
ad.show()
You can check the reason like this
rewardedAd.onEvent.listen((e) { final event = e.keys.first; switch (event) { case RewardedAdEvent.showFailed: final error = e.values.first; print('show failed ${error.code}'); break; default: break; } });
For more info, read the documentation
- closed → const RewardedAdEvent
-
Called when the ad is closed
- earnedReward → const RewardedAdEvent
-
Called when the user earns an reward. You can check the reward item like this:
rewardedAd.onEvent.listen((e) { final event = e.keys.first; switch (event) { case RewardedAdEvent.earnedReward: final reward = e.values.first; print('earned reward: $reward'); break; default: break; } });
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
RewardedAdEvent> - A constant List of the values in this enum, in order of their declaration.