track method

void track(
  1. String name, {
  2. Map<String, Object?>? properties,
})

Track a named event with optional properties.

Implementation

void track(String name, {Map<String, Object?>? properties}) {
  onTracked?.call(name);
  _queue.add({
    'name': name,
    if (properties != null || _cfg.defaultProperties.isNotEmpty)
      'properties': {..._cfg.defaultProperties, ...?properties},
    'timestamp': DateTime.now().toUtc().toIso8601String(),
  });
}