init method Null safety

Future<Mixpanel> init(
  1. String token,
  2. {bool optOutTrackingDefault = false,
  3. Map<String, dynamic>? superProperties}

Initializes an instance of the API with the given project token.

  • token your project token.
  • optOutTrackingDefault Optional Whether or not Mixpanel can start tracking by default. See optOutTracking()
  • superProperties Optional super properties to register


static Future<Mixpanel> init(String token,
    {bool optOutTrackingDefault = false, Map<String, dynamic>? superProperties}) async {
  var allProperties = <String, dynamic>{'token': token};
  allProperties['optOutTrackingDefault'] = optOutTrackingDefault;
  allProperties['mixpanelProperties'] = _mixpanelProperties;
  allProperties['superProperties'] = superProperties;
  await _channel.invokeMethod<void>('initialize', allProperties);
  return Mixpanel(token);