init method

Future<void> init([
  1. String? situmUser,
  2. String? situmApiKey
])

Initializes and authenticates SitumSdk.

This method must be called before invoking any other methods. The use of parameters in this method is deprecated, instead call it without them followed by setApiKey to authenticate yourself.

Note: If you call this method without providing any parameters, it will only initialize the SDK. In this case, ensure to call setApiKey afterwards.

Implementation

Future<void> init([String? situmUser, String? situmApiKey]) async {
  if (situmApiKey == null) {
    await methodChannel.invokeMethod<String>('initSdk');
  } else {
    await methodChannel.invokeMethod<String>(
      'init',
      <String, dynamic>{
        'situmUser': "---@situm.com",
        // Underlying sdk expects to have a non empty, non null and valid email. But is not used anymore.
        'situmApiKey': situmApiKey,
      },
    );
  }
}