loadAndShowInterAd method

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

Implementation

@override
void loadAndShowInterAd({AdModuleWithCallBacks? adModuleCallBacks}) {
  final interstitialAd = InterstitialAd(
    GlobalAdVariables.adNetworkIds?['facebook']?.interId ?? "",
  );
  interstitialAd.listener = InterstitialAdListener(
    onLoaded: () {
      interstitialAd.show();
      if (adModuleCallBacks != null) {
        if (adModuleCallBacks.onAdLoaded != null) {
          adModuleCallBacks.onAdLoaded!();
        }
      }
    },
    onDismissed: () {
      interstitialAd.destroy();
      log('Facebook:[Inter]->Interstitial dismissed');
      if (adModuleCallBacks != null) {
        if (adModuleCallBacks.onCloseEvent != null) {
          adModuleCallBacks.onCloseEvent!();
        }
      }
    },
    onError: (code, message) {
      if (adModuleCallBacks != null) {
        if (adModuleCallBacks.onFailed != null) {
          adModuleCallBacks.onFailed!();
        }
      }
    },
  );
  interstitialAd.load();
}