loadBannerAdTurbo method

Future<void> loadBannerAdTurbo({
  1. required String adUnitId,
  2. required AdSize adSize,
  3. List<String>? keywords,
  4. String? contentUrl,
  5. List<String>? neighboringContentUrls,
  6. bool? nonPersonalizedAds,
  7. int? httpTimeoutMillis,
  8. String? mediationExtrasIdentifier,
  9. Map<String, String>? extras,
  10. AdEventCallback? onAdLoaded,
  11. AdLoadErrorCallback? onAdFailedToLoad,
  12. AdEventCallback? onAdOpened,
  13. AdEventCallback? onAdClosed,
  14. AdEventCallback? onAdWillDismissScreen,
  15. AdEventCallback? onAdImpression,
  16. OnPaidEventCallback? onPaidEvent,
  17. AdEventCallback? onAdClicked,
})

Implementation

Future<void> loadBannerAdTurbo({
  required String adUnitId,
  required AdSize adSize,
  List<String>? keywords,
  String? contentUrl,
  List<String>? neighboringContentUrls,
  bool? nonPersonalizedAds,
  int? httpTimeoutMillis,
  String? mediationExtrasIdentifier,
  Map<String, String>? extras,
  AdEventCallback? onAdLoaded,
  AdLoadErrorCallback? onAdFailedToLoad,
  AdEventCallback? onAdOpened,
  AdEventCallback? onAdClosed,
  AdEventCallback? onAdWillDismissScreen,
  AdEventCallback? onAdImpression,
  OnPaidEventCallback? onPaidEvent,
  AdEventCallback? onAdClicked,
}) async {
  bannerAd = BannerAd(
    adUnitId: adUnitId,
    request: AdRequest(
      keywords: keywords,
      contentUrl: contentUrl,
      neighboringContentUrls: neighboringContentUrls,
      nonPersonalizedAds: nonPersonalizedAds,
      httpTimeoutMillis: httpTimeoutMillis,
      mediationExtrasIdentifier: mediationExtrasIdentifier,
      extras: extras,
    ),
    size: adSize,

    /// bannerAd size as per need
    listener: BannerAdListener(
      onAdClicked: onAdClicked,
      onPaidEvent: onPaidEvent,

      /// Called when an BannerAd is successfully received.
      onAdLoaded: onAdLoaded,

      /// Called when an BannerAd request failed.
      onAdFailedToLoad: onAdFailedToLoad,

      /// Called when an BannerAd opens an overlay that covers the screen.
      onAdOpened: onAdOpened,

      /// Called when an BannerAd removes an overlay that covers the screen.
      onAdClosed: onAdClosed,

      /// Called when an impression occurs on the BannerAd.
      onAdImpression: onAdImpression,

      /// For iOS only. Called before dismissing a full screen view.
      onAdWillDismissScreen: onAdWillDismissScreen,
    ),
  );
  bannerAd.load();
}