trackWithGroups method Null safety

void trackWithGroups(
  1. String eventName,
  2. Map<String, dynamic> properties,
  3. Map<String, dynamic> groups

Track an event with specific groups.

Every call to track eventually results in a data point sent to Mixpanel. These data points are what are measured, counted, and broken down to create your Mixpanel reports. Events have a string name, and an optional set of name/value pairs that describe the properties of that event. Group key/value pairs are upserted into the property map before tracking.

  • eventName The name of the event to send
  • properties A Map containing the key value pairs of the properties to include in this event.
  • groups A Map containing the group key value pairs for this event.


void trackWithGroups(String eventName, Map<String, dynamic> properties,
    Map<String, dynamic> groups) {
  if (_MixpanelHelper.isValidString(eventName)) {
    _channel.invokeMethod<void>('trackWithGroups', <String, dynamic>{
      'eventName': eventName,
      'properties': properties,
      'groups': groups
  } else {
    developer.log('`trackWithGroups` failed: eventName cannot be blank',
        name: 'Mixpanel');