loadInterstitialAd method
Future<PangleResult>
loadInterstitialAd({
- IOSInterstitialConfig? iOS,
- AndroidInterstitialConfig? android,
- PangleEventCallback? callback,
Request interstitial ad data.
iOS
config for iOS
android
config for Android
callback
event callback
return loaded ad count.
Implementation
Future<PangleResult> loadInterstitialAd({
IOSInterstitialConfig? iOS,
AndroidInterstitialConfig? android,
PangleEventCallback? callback,
}) async {
final subscription = _eventChannel
.receiveBroadcastStream(PangleEventType.interstitial.index)
.listen((dynamic event) {
callback?.call(event);
});
Map<String, dynamic>? result;
try {
if (Platform.isIOS && iOS != null) {
result = await _methodChannel.invokeMapMethod<String, dynamic>(
'loadInterstitialAd',
iOS.toJSON(),
);
} else if (Platform.isAndroid && android != null) {
result = await _methodChannel.invokeMapMethod<String, dynamic>(
'loadInterstitialAd',
android.toJSON(),
);
}
} finally {
subscription.cancel();
}
return PangleResult.fromJson(result);
}