init static method

Future<void> init({
  1. required String adjustKey,
  2. bool? launchDeferredDeeplink,
  3. bool? launchLinkMeEnabled,
  4. DeferredDeeplinkCallback? deferredDeeplinkCallback,
})

Initialize DSAdjust adjustKey - API key of Adjust

Implementation

static Future<void> init({
  required String adjustKey,
  bool? launchDeferredDeeplink,
  bool? launchLinkMeEnabled,
  DeferredDeeplinkCallback? deferredDeeplinkCallback,
}) async {
  if (_isInitialized) {
    Fimber.e('DSAdjust is already initialised', stacktrace: StackTrace.current);
    return;
  }

  await DSConstants.I.waitForInit();
  final config = AdjustConfig(
      adjustKey, DSConstants.I.isInternalVersion ? AdjustEnvironment.sandbox : AdjustEnvironment.production);
  config.logLevel = AdjustLogLevel.verbose;
  config.attributionCallback = _setAdjustAttribution;
  config.isDeferredDeeplinkOpeningEnabled = launchDeferredDeeplink;
  config.deferredDeeplinkCallback = deferredDeeplinkCallback;
  config.isLinkMeEnabled = launchLinkMeEnabled;
  Adjust.initSdk(config);

  _isInitialized = true;

  // init adid
  getAdid();

  for (final callback in _initCallbacks) {
    callback();
  }
}