loadInterAd method
void
loadInterAd(
{ - AdModuleWithCallBacks? adModuleCallBacks,
})
override
Implementation
@override
void loadInterAd({AdModuleWithCallBacks? adModuleCallBacks}) {
if (interstitialAd != null) {
adModuleCallBacks?.onAdLoaded ?? (() {});
return;
}
log("Google[Load]@Id:${GlobalAdVariables.adNetworkIds!['google']!.interId!}");
InterstitialAd.load(
adUnitId: GlobalAdVariables.adNetworkIds!['google']!.interId!,
request: const AdRequest(),
adLoadCallback: InterstitialAdLoadCallback(
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();
interstitialAd = null;
},
onAdClicked: (ad) {},
);
interstitialAd = 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!();
}
}
},
),
);
}