alias method Null safety

void alias(
  1. String alias,
  2. String distinctId
)

The alias method creates an alias which Mixpanel will use to remap one id to another. Multiple aliases can point to the same identifier.

mixpanel.alias("New ID", mixpanel.distinctId) mixpanel.alias("Newer ID", mixpanel.distinctId)

This call does not identify the user after. You must still call both identify() and People.identify() if you wish the new alias to be used for Events and People.

  • alias A unique identifier that you want to use as an identifier for this user.
  • distinctId the current distinct_id that alias will be mapped to.

Implementation

void alias(String alias, String distinctId) {
  if (!_MixpanelHelper.isValidString(alias)) {
    developer.log('`alias` failed: alias cannot be blank', name: 'mixpanel');
    return;
  }
  if (!_MixpanelHelper.isValidString(distinctId)) {
    developer.log('`alias` failed: distinctId cannot be blank',
        name: 'Mixpanel');
    return;
  }
  _channel.invokeMethod<void>(
      'alias', <String, dynamic>{'alias': alias, 'distinctId': distinctId});
}