showInterstitial method

  1. @override
Future<bool> showInterstitial()
override

Shows a preloaded interstitial ad.

Returns true if the ad was shown, false if skipped due to:

  • Ad not loaded yet
  • Frequency cap not elapsed
  • No interstitial ID configured

After showing, automatically preloads the next interstitial.

Implementation

@override
Future<bool> showInterstitial() async {
  showInterstitialCallCount++;
  if (!nextInterstitialResult) return false;
  emitEvent(const AdEvent(type: AdEventType.shown));
  _interstitialState = AdState.idle;
  return true;
}