trackEvent method
Track an event.
The event name is required and must not be empty. It should be composed of letters, numbers or underscores ([a-z0-9_]) and can’t be longer than 30 characters.
The event attributes
are an optional object holding attributes related
to the event. See BatchEventAttributes's documentation for more info.
Implementation
void trackEvent({required String name, BatchEventAttributes? attributes}) {
Map eventArgs = {"name": name};
if (attributes != null) {
eventArgs["event_data"] = attributes.internalGetBridgeRepresentation();
}
_channel.invokeMethod("profile.track.event", eventArgs).catchError((error) => {
BatchLogger.public("Tracking event '"+ name +"' failed with error: " + error.toString())
});
}