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

hashCode int
The hash code for this object. [...]
read-only, inherited
listener RewardedVideoAdListener
Callback invoked for events in the rewarded video ad lifecycle.
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

load({String adPlatform, String adUnitId, dynamic userId, MobileAdTargetingInfo targetingInfo}) Future<bool>
Loads a rewarded video ad using the provided ad unit ID.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
show(String adPlatform) 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.
read-only