showInter method Null safety

void showInter()

Implementation

static void showInter() {
  /// show inter ads
  log("show inter");

  if (kIsWeb) {
    AdsenseAdsView.showInter();
  }

  InterstitialAd.load(
      adUnitId: "ca-app-pub-8286573828419993/3719950010",
      request: const AdRequest(),
      adLoadCallback: InterstitialAdLoadCallback(
        onAdLoaded: (InterstitialAd interAd) {
          // Keep a reference to the ad so you can show it later.
          interAd.fullScreenContentCallback = FullScreenContentCallback(
            onAdShowedFullScreenContent: (InterstitialAd ad) =>
                log('%ad onAdShowedFullScreenContent.'),
            onAdDismissedFullScreenContent: (InterstitialAd ad) {
              log('$ad onAdDismissedFullScreenContent.');
              ad.dispose();
            },
            onAdFailedToShowFullScreenContent:
                (InterstitialAd ad, AdError error) {
              log('$ad onAdFailedToShowFullScreenContent: $error');
              ad.dispose();
            },
            onAdImpression: (InterstitialAd ad) =>
                log('$ad impression occurred.'),
          );

          interAd.show();
        },
        onAdFailedToLoad: (LoadAdError error) {
          log(
            'InterstitialAd failed to load: $error',
            error: error,
          );
        },
      ));
}