set method Null safety

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

Sets a single property with the given name and value for this group. The given name and value will be assigned to the user in Mixpanel Group 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 to set on the given property name. For "Zip Code", this value might be the String "90210"

Implementation

void set(String prop, String to) {
  if (_MixpanelHelper.isValidString(prop)) {
    Map<String, dynamic> properties = {prop: to};

    _channel.invokeMethod<void>('groupSetProperties', <String, dynamic>{
      'token': this._token,
      'groupKey': this._groupKey,
      'groupID': this._groupID,
      'properties': properties
    });
  } else {
    developer.log('`group set` failed: prop cannot be blank',
        name: 'Mixpanel');
  }
}