initialize static method

Future<BKTResult<void>> initialize({
  1. required BKTConfig config,
  2. required BKTUser user,
  3. int? timeoutMillis,
})

Implementation

static Future<BKTResult<void>> initialize({
  required BKTConfig config,
  required BKTUser user,
  int? timeoutMillis,
}) async {
  var rs = await instance._invokeMethod(
    CallMethods.initialize.name,
    argument: {
      'apiKey': config.apiKey,
      'apiEndpoint': config.apiEndpoint,
      'featureTag': config.featureTag,
      'debugging': config.debugging,
      'eventsFlushInterval': config.eventsFlushInterval,
      'eventsMaxQueueSize': config.eventsMaxQueueSize,
      'pollingInterval': config.pollingInterval,
      'backgroundPollingInterval': config.backgroundPollingInterval,
      'appVersion': config.appVersion,
      'timeoutMillis': timeoutMillis,
      'userId': user.id,
      'userAttributes': user.attributes,
    },
  );
  // The native code might emit a `BKTException`,
  // so we must use `BKTResult` to handle the exceptions
  return statusGuard(rs);
}