initialize static method

Future<void> initialize({
  1. EventCallbackFunc callbackHandle = _defaultCallbackHandle,
})

Initialize the plugin and request relevant permissions from the user.

Implementation

static Future<void> initialize({
  EventCallbackFunc callbackHandle = _defaultCallbackHandle,
}) async {
  final CallbackHandle _callbackDispatch =
      PluginUtilities.getCallbackHandle(callbackDispatcher)!;
  await _methodChannel.invokeMethod(
      'plugin.initialize', _callbackDispatch.toRawHandle());

  // call this call back in the current engine
  // this is important to use ui flutter engine access `service.channel`
  callbackDispatcher(inited: false);

  // register event handler
  // register the default event handler
  await registerEventHandle(callbackHandle);
}