RewardedVideoAd class

An AdMob rewarded video ad.

This class is a singleton, and RewardedVideoAd.instance provides a reference to the single instance, which is created at launch. The native Android and iOS APIs for AdMob use a singleton to manage rewarded video ad objects, and that pattern is reflected here.

Apps should assign a callback function to RewardedVideoAd's listener property in order to receive reward notifications from the AdMob SDK:

RewardedVideoAd.instance.listener = (RewardedVideoAdEvent event,
    [String rewardType, int rewardAmount]) {
    print("You were rewarded with $rewardAmount $rewardType!");
  }
};

The function will be invoked when any of the events in RewardedVideoAdEvent occur.

To load and show ads, call the load method:

RewardedVideoAd.instance.load(myAdUnitString, myTargetingInfoObj);

Later (any point after your listener callback receives the RewardedVideoAdEvent.loaded event), call the show method:

RewardedVideoAd.instance.show();

Only one rewarded video ad can be loaded at a time. Because the video assets are so large, it's a good idea to start loading an ad well in advance of when it's likely to be needed.

Properties

customData String?
The custom data included in server-to-server reward callbacks
getter/setter pair
hashCode int?
The hash code for this object.
no setterinherited
listener RewardedVideoAdListener?
Callback invoked for events in the rewarded video ad lifecycle.
getter/setter pair
runtimeType Type?
A representation of the runtime type of the object.
no setterinherited
userId String?
The user id used in server-to-server reward callbacks
getter/setter pair

Methods

load({String? adUnitId, MobileAdTargetingInfo? targetingInfo = const MobileAdTargetingInfo()}) Future<bool?>?
Loads a rewarded video ad using the provided ad unit ID.
noSuchMethod(Invocation? invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
show() Future<bool?>?
Shows a rewarded video ad if one has been loaded.
toString() String?
A string representation of this object.
inherited

Operators

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

Static Properties

instance RewardedVideoAd?
The one and only instance of this class.
no setter
testAdUnitId String?
A platform-specific AdMob test ad unit ID for rewarded video ads. This ad unit has been specially configured to always return test ads, and developers are encouraged to use it while building and testing their apps.
final