initialize static method
Initializes the library with provided API Keys and optional notification configuration.
configuration
An instance of OkHiAppConfiguration
Implementation
static Future<bool> initialize(OkHiAppConfiguration configuration) async {
_configuration = configuration;
final credentials = {
"branchId": configuration.branchId,
"clientKey": configuration.clientKey,
"environment": configuration.environmentRawValue,
"notification": configuration.notification.toMap()
};
final initState =
await _channel.invokeMethod(OkHiNativeMethod.initialize, credentials);
if (WidgetsBinding.instance.lifecycleState == AppLifecycleState.resumed &&
Platform.isIOS) {
await _channel.invokeMethod(OkHiNativeMethod.onStart);
}
return initState;
}