loadInterstitial method

  1. @override
Future<void> loadInterstitial()
override

Preloads an interstitial ad.

Does nothing if AdConfig.interstitialId is null. Automatically retries with exponential backoff on failure.

Throws StateError if not initialized.

Implementation

@override
Future<void> loadInterstitial() async {
  loadInterstitialCallCount++;
  if (simulateLoadFailure) {
    _interstitialState = AdState.error;
    emitEvent(const AdEvent(
      type: AdEventType.failedToLoad,
      error: AdError(code: 0, message: 'Simulated failure'),
    ));
    return;
  }
  _interstitialState = AdState.ready;
}