append method Null safety

void append(
  1. String name,
  2. dynamic value
)

Appends a value to a list-valued property. If the property does not currently exist, it will be created as a list of one element. If the property does exist and doesn't currently have a list value, the append will be ignored.

  • name the People Analytics property that should have it's value appended to
  • value the new value that will appear at the end of the property's list

Implementation

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