initialize static method
Future<void>
initialize({
- required String gameId,
- Function? onComplete,
- dynamic onFailed(
- InitializationError error,
- String errorMessage
Initializes the Unity Mediation. It is mandatory to call this method before any InterstitialAd and RewardedAd can load.
gameId
- The game ID listed in publisher dashboard.onComplete
- called when initialization has completed successfully.onFailed
- called when initialization has failed.
Implementation
static Future<void> initialize({
required String gameId,
Function? onComplete,
Function(InitializationError error, String errorMessage)? onFailed,
}) async {
Map<String, dynamic> arguments = {
gameIdParameter: gameId,
};
_channel.setMethodCallHandler(
(call) => _initMethodCall(call, onComplete, onFailed));
await _channel.invokeMethod(initMethod, arguments);
}