init method

Future<void> init()

This function initializes a Synerise SDK instance with specified parameters and invokes a completion handler.

Implementation

Future<void> init() async {
  if (syneriseInitialized == true) {
    return;
  }

  if (completionHandler != null) {
    completionHandler!(false);
  }

  final result = await methodChannel.invokeMethod('Synerise/initialize', {
    'initializationParameters': {
      'clientApiKey': _clientApiKey,
      'baseUrl': _baseUrl,
      'debugModeEnabled': _debugModeEnabled,
      'crashHandlingEnabled': _crashHandlingEnabled,
      'requestValidationSalt': _requestValidationSalt,
      'messagingServiceType': _messagingServiceType
    }
  });

  if (completionHandler != null) {
    completionHandler!(true);
  }

  syneriseInitialized = true;

  return result;
}