load static method
Future<void>
load({
- required String placementId,
- dynamic onComplete(
- String placementId
- dynamic onFailed(
- String placementId,
- UnityAdsLoadError error,
- String errorMessage
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, UnityAdsLoadError error, String errorMessage)?
onFailed,
}) async {
_adChannels
.putIfAbsent(placementId, () => _AdMethodChannel(placementId))
.update(
onLoadComplete: onComplete,
onLoadFailed: onFailed,
);
final arguments = <String, dynamic>{
placementIdParameter: placementId,
};
await _channel.invokeMethod(loadMethod, arguments);
}