showInterstitailAd static method
Future<bool?>
showInterstitailAd({
- required String placementId,
- dynamic listener(
- UnityAdsState adState,
- Map<
String, dynamic> result
Show Interstitial Ad, if ready.
placementId
placement identifier, as defined in Unity Ads Dashboard
UnityAdsState adState - current state of the ad
listener
- callback for ad state changes
Implementation
static Future<bool?> showInterstitailAd({
required String placementId,
Function(UnityAdsState adState, Map<String, dynamic> result)? listener,
}) async {
try {
if (listener != null) {
_channels
.putIfAbsent(placementId,
() => MethodChannel('${fullAdChannel}_$placementId'))
.setMethodCallHandler((call) => _showMethodCall(call, listener));
}
return await _channel.invokeMethod(showInterstitialAdMethod, {
placementIdParameter: placementId,
});
} on PlatformException {
return false;
}
}