initialize static method

Future<void> initialize({
  1. required String gameId,
  2. Function? onComplete,
  3. dynamic onFailed(
    1. UnityMediationInitializationError error,
    2. String errorMessage
    )?,
})

Initializes Unity Mediation. UnityMediation should be initialized when app starts.

  • gameId - unique identifier for a game, given by Unity Ads admin tools.
  • onComplete - called when UnityMediation is successfully initialized
  • onFailed - called when UnityMediation is failed in initialization.

Implementation

static Future<void> initialize({
  required String gameId,
  Function? onComplete,
  Function(UnityMediationInitializationError error, String errorMessage)? onFailed,
}) async {
  Map<String, dynamic> arguments = {
    gameIdParameter: gameId,
  };
  _channel.setMethodCallHandler(
          (call) => _initializeMethodCall(call, onComplete, onFailed));
  await _channel.invokeMethod(initializeMethod, arguments);
}