show method
Shows the preloaded interstitial ad.
Returns true if the ad was shown, false if:
- No ad is loaded
- The frequency cap interval has not elapsed
After a successful show, the next ad is automatically preloaded.
Implementation
Future<bool> show() async {
if (_isDisposed) return false;
if (_state != AdState.ready) return false;
if (!_frequencyCap.canShow) return false;
_state = AdState.showing;
final resolvedId = adUnitId.resolved(adType: AdType.interstitial);
// In production, this would call interstitialAd.show()
_frequencyCap.recordImpression();
_emitEvent(AdEvent(type: AdEventType.shown, adUnitId: resolvedId));
_state = AdState.idle;
// Auto-preload next
unawaited(load());
return true;
}