set method Null safety

void set(
  1. String prop,
  2. dynamic to

Sets a single property with the given name and value for this user. The given name and value will be assigned to the user in Mixpanel People Analytics, possibly overwriting an existing property with the same name.

  • prop The name of the Mixpanel property. This must be a String, for example "Zip Code"
  • to The value of the Mixpanel property. For "Zip Code", this value might be the String "90210"


void set(String prop, dynamic to) {
  if (_MixpanelHelper.isValidString(prop)) {
    Map<String, dynamic> properties = {prop: to};
        <String, dynamic>{'token': this._token, 'properties': properties});
  } else {
    developer.log('`people set` failed: prop cannot be blank',
        name: 'Mixpanel');