showInterstitialAd static method

Future<bool?> showInterstitialAd(
  1. int id, {
  2. int? delay = 0,
})

Shows an Interstitial Ad after it has been loaded. (This needs to be called only after calling loadInterstitialAd function). delay is in milliseconds.

Example:

InterstitialAdPlatformInterface.loadInterstitialAd(
  listener: (result, value) {
    if (result == InterstitialAdResult.LOADED)
      InterstitialAdPlatformInterface.showInterstitialAd(delay: 5000);
  },
);

Implementation

static Future<bool?> showInterstitialAd(int id, {int? delay = 0}) async {
  try {
    final args = <String, dynamic>{
      "id": id,
      "delay": delay,
    };

    final result = await _channel.invokeMethod(
      SHOW_INTERSTITIAL_METHOD,
      args,
    );

    return result;
  } on PlatformException {
    return false;
  }
}