loadInterstitialAd static method

Future<bool?> loadInterstitialAd(
  1. int id, {
  2. String placementId = "YOUR_PLACEMENT_ID",
  3. required dynamic listener(
    1. InterstitialAdPlatformInterfaceResult,
    2. dynamic
    ),
})

Loads an Interstitial Ad in background. Replace the default placementId with the one which you obtain by signing-up for Facebook Audience Network.

listener passes InterstitialAdPlatformInterfaceResult and information associated with the result to the implemented callback.

Information will generally be of type Map with details such as:

{
  'placement\_id': "YOUR\_PLACEMENT\_ID",
  'invalidated': false,
  'error\_code': 2,
  'error\_message': "No internet connection",
}

Implementation

static Future<bool?> loadInterstitialAd(
  int id, {
  String placementId = "YOUR_PLACEMENT_ID",
  required Function(InterstitialAdPlatformInterfaceResult, dynamic) listener,
}) async {
  try {
    final args = <String, dynamic>{
      "id": id,
      "placementId": placementId,
    };

    final result = await _channel.invokeMethod(
      LOAD_INTERSTITIAL_METHOD,
      args,
    );
    _channel.setMethodCallHandler(_interstitialMethodCall);
    _listeners[id] = listener;

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