increment method

void increment (
  1. String prop,
  2. double by
)

Add the given amount to an existing property on the identified user. If the user does not already have the associated property, the amount will be added to zero. To reduce a property, provide a negative number for the value.

  • prop the People Analytics property that should have its value changed
  • by the amount to be added to the current value of the named property

Implementation

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