track static method

Future<void> track(
  1. Event event, {
  2. required String tracker,
  3. List<SelfDescribing>? contexts,
})

Tracks the given event using the specified tracker namespace and with optional context entities.

Implementation

static Future<void> track(Event event,
    {required String tracker, List<SelfDescribing>? contexts}) async {
  var message = {
    'tracker': tracker,
    'eventData': event.toMap(),
    'contexts': contexts?.map((c) => c.toMap()).toList()
  };
  message.removeWhere((key, value) => value == null);
  await _channel.invokeMethod(event.endpoint(), message);
}