AdEvent class
An event emitted by the ad management system.
Events carry the type and optional contextual data such as adUnitId, error, reward, or paidValue.
adManager.onAdEvent.listen((event) {
switch (event.type) {
case AdEventType.rewardEarned:
print('Earned ${event.reward!.amount} ${event.reward!.type}');
case AdEventType.failedToLoad:
print('Ad failed: ${event.error?.message}');
default:
break;
}
});
Constructors
- AdEvent({required AdEventType type, String? adUnitId, AdError? error, AdReward? reward, AdPaidValue? paidValue})
-
Creates an ad event.
const
Properties
- adUnitId → String?
-
The ad unit ID that originated this event, if applicable.
final
- error → AdError?
-
Error information when type is AdEventType.failedToLoad.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- paidValue → AdPaidValue?
-
Revenue data when type is AdEventType.paidEvent.
final
- reward → AdReward?
-
Reward information when type is AdEventType.rewardEarned.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- type → AdEventType
-
The type of this event.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited