AdBreakPlacement.interstitial constructor

AdBreakPlacement.interstitial({
  1. required BreakType type,
  2. String? name,
  3. H5BeforeAdCallback? beforeAd,
  4. H5AfterAdCallback? afterAd,
  5. H5AdBreakDoneCallback? adBreakDone,
})

Convenience factory to create an interstitial ad configuration.

The following parameters are available:

  • name: A name for this particular ad placement within your game. It is an internal identifier, and is not shown to the player. Recommended.
  • beforeAd: Called before the ad is displayed. The game should pause and mute the sound. These actions must be done synchronously. The ad will be displayed immediately after this callback finishes..
  • afterAd: Called after the ad is finished (for any reason). For rewarded ads, it is called after either adDismissed or adViewed, depending on player actions
  • adBreakDone: Always called as the last step in an adBreak, even if there was no ad shown. Takes as argument a placementInfo object. See AdBreakDonePlacementInfo, and: https://developers.google.com/ad-placement/apis/adbreak#adbreakdone_and_placementinfo

See: https://developers.google.com/ad-placement/apis#interstitials

Implementation

factory AdBreakPlacement.interstitial({
  required BreakType type,
  String? name,
  H5BeforeAdCallback? beforeAd,
  H5AfterAdCallback? afterAd,
  H5AdBreakDoneCallback? adBreakDone,
}) {
  assert(interstitialBreakType.contains(type),
      '$type is not a valid interstitial placement type.');
  return AdBreakPlacement(
    type: type,
    name: name,
    beforeAd: beforeAd,
    afterAd: afterAd,
    adBreakDone: adBreakDone,
  );
}