setInterstitialCallbacks static method

void setInterstitialCallbacks({
  1. dynamic onInterstitialLoaded(
    1. bool isPrecache
    )?,
  2. Function? onInterstitialFailedToLoad,
  3. Function? onInterstitialShown,
  4. Function? onInterstitialShowFailed,
  5. Function? onInterstitialClicked,
  6. Function? onInterstitialClosed,
  7. Function? onInterstitialExpired,
})

Set Interstitial ads callbacks

onInterstitialLoaded Called when interstitial was loaded, isPrecache - true if interstitial is precache. onInterstitialFailedToLoad Called when interstitial is fail to load. But if auto cache enabled for interstitials, loading will be continued. onInterstitialShown Called when interstitial was shown. onInterstitialShowFailed Called when interstitial show failed. onInterstitialClicked Called when interstitial was clicked. onInterstitialClosed Called when interstitial was closed. onInterstitialExpired Called when interstitial was expired by time.

Implementation

static void setInterstitialCallbacks(
    {Function(bool isPrecache)? onInterstitialLoaded,
    Function? onInterstitialFailedToLoad,
    Function? onInterstitialShown,
    Function? onInterstitialShowFailed,
    Function? onInterstitialClicked,
    Function? onInterstitialClosed,
    Function? onInterstitialExpired}) {
  _interstitialChannel.setMethodCallHandler((call) async {
    switch (call.method) {
      case 'onInterstitialLoaded':
        onInterstitialLoaded?.call(call.arguments['isPrecache']);
        break;
      case 'onInterstitialFailedToLoad':
        onInterstitialFailedToLoad?.call();
        break;
      case 'onInterstitialShown':
        onInterstitialShown?.call();
        break;
      case 'onInterstitialShowFailed':
        onInterstitialShowFailed?.call();
        break;
      case 'onInterstitialClicked':
        onInterstitialClicked?.call();
        break;
      case 'onInterstitialClosed':
        onInterstitialClosed?.call();
        break;
      case 'onInterstitialExpired':
        onInterstitialExpired?.call();
        break;
    }
  });
}