load static method
Load a placement to make it available to show. Ads generally take a few seconds to finish loading before they can be shown.
placementId
- the placement ID, as defined in Unity Ads admin tools.onComplete
- callback triggered when a load request has successfully filled the specified placementId with an ad that is ready to show.onFailed
- called when load request has failed to load an ad for a requested placement.
Implementation
static Future<void> load({
required String placementId,
Function(String placementId)? onComplete,
Function(String placementId, UnityMediationAdsLoadError error, String errorMessage)?
onFailed,
}) async {
UnityAdsBase.channels
.putIfAbsent(
placementId, () => MethodChannel('${interstitialAdChannel}_$placementId'))
.setMethodCallHandler(
(call) => _loadMethodCall(call, onComplete, onFailed));
final arguments = <String, dynamic>{
placementIdParameter: placementId,
};
await UnityAdsBase.channel.invokeMethod(interstitialAdLoadMethod, arguments);
}