loadRewardInter method

  1. @override
void loadRewardInter({
  1. AdModuleWithCallBacks? adModuleCallBacks,
})
override

Implementation

@override
void loadRewardInter({AdModuleWithCallBacks? adModuleCallBacks}) {
  RewardedInterstitialAd.load(
    adUnitId: GlobalAdVariables.adNetworkIds!['google']!.interRewardId!,
    request: const AdRequest(),
    rewardedInterstitialAdLoadCallback: RewardedInterstitialAdLoadCallback(
      onAdLoaded: (ad) {
        ad.fullScreenContentCallback = FullScreenContentCallback(
          onAdShowedFullScreenContent: (ad) {},
          onAdImpression: (ad) {},
          onAdFailedToShowFullScreenContent: (ad, err) {
            ad.dispose();
          },
          onAdDismissedFullScreenContent: (ad) {
            if (adModuleCallBacks != null) {
              if (adModuleCallBacks.onCloseEvent != null) {
                adModuleCallBacks.onCloseEvent!();
              }
            }
            ad.dispose();
            rewardedAd = null;
          },
          onAdClicked: (ad) {},
        );
        rewardedInterstitialAd = ad;
        if (adModuleCallBacks != null) {
          if (adModuleCallBacks.onAdLoaded != null) {
            adModuleCallBacks.onAdLoaded!();
          }
        }
      },
      onAdFailedToLoad: (error) {
        log(error.message.toString());
        if (adModuleCallBacks != null) {
          if (adModuleCallBacks.onLoadFailed != null) {
            adModuleCallBacks.onLoadFailed!();
          }
        }
      },
    ),
  );
}