loadAd method
This will load both rewarded and interstitial ads. If a particular ad is already loaded, it will not load it again. Also you do not have to call this method everytime. Ad is automatically loaded after being displayed.
if adNetwork
is provided, only that network's ad will be loaded
if adUnitType
is provided, only that unit type will be loaded, otherwise all unit types will be loaded
Implementation
void loadAd({AdNetwork adNetwork = AdNetwork.any, AdUnitType? adUnitType}) {
if (adUnitType == null || adUnitType == AdUnitType.rewarded) {
for (final e in _rewardedAds) {
if (adNetwork == AdNetwork.any || adNetwork == e.adNetwork) {
e.load();
}
}
}
if (adUnitType == null || adUnitType == AdUnitType.interstitial) {
for (final e in _interstitialAds) {
if (adNetwork == AdNetwork.any || adNetwork == e.adNetwork) {
e.load();
}
}
}
if (adUnitType == null || adUnitType == AdUnitType.appOpen) {
for (final e in _appOpenAds) {
if (adNetwork == AdNetwork.any || adNetwork == e.adNetwork) {
e.load();
}
}
}
}