initialize method
Implementation
Future<void> initialize({String? userAgent}) async {
_creatingCompleter = Completer<void>();
try {
if (userAgent != null && userAgent.isNotEmpty) {
await pluginChannel.invokeMethod('init', userAgent);
} else {
await pluginChannel.invokeMethod('init');
}
pluginChannel.setMethodCallHandler(methodCallhandler);
// Wait for the platform to complete initialization.
await Future.delayed(const Duration(milliseconds: 300));
_creatingCompleter.complete();
value = true;
} on PlatformException catch (e) {
_creatingCompleter.completeError(e);
}
return _creatingCompleter.future;
}