timeEvent method Null safety

void timeEvent(
  1. String eventName
)

Begin timing of an event. Calling timeEvent("Thing") will not send an event, but when you eventually call track("Thing"), your tracked event will be sent with a "$duration" property, representing the number of seconds between your calls.

  • eventName the name of the event to track with timing.

Implementation

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