show method

Future<bool> show({
  1. Duration? autoDismissDelay,
})

Shows the interstitial ad.

Returns a Future that completes with a bool value indicating whether the ad was successfully shown. If the ad has already been shown, this method will return false immediately, as an interstitial ad can only be shown once. The autoDismissDelay parameter specifies the duration after which the ad should automatically dismiss. If no autoDismissDelay is provided, the ad will not automatically dismiss.

Implementation

Future<bool> show({Duration? autoDismissDelay}) async {
  if (_hasBeenShown) {
    debugPrint('interstitial ad has already been shown, cannot show again');
    return false;
  }
  final result = await _controller.showInterstitialAd(
    autoDismissDelay: autoDismissDelay,
  );
  if (result) {
    _hasBeenShown = true;
  }
  return result;
}