show method

Future<void> show()

Shows the loaded interstitial ad.

If the ad is not loaded, this method does nothing. After showing, isLoaded is set to false.

Throws a PlatformException if showing fails.

Implementation

Future<void> show() async {
  if (!_isLoaded) {
    print('Interstitial ad not ready to show');
    return;
  }

  try {
    print('Showing interstitial ad...');
    await HighfivveAdManager.instance.showInterstitialAd();
    _isLoaded = false;
    print('Interstitial ad shown successfully');
  } on PlatformException catch (e) {
    print('Failed to show interstitial ad: ${e.message}');
  }
}