trackEvent method

  1. @override
Future<void> trackEvent(
  1. String eventName,
  2. Map<String, Object>? eventParams,
  3. List<String>? segmentationEventParamKeys
)
override

Track an event.

Implementation

@override
Future<void> trackEvent(
  String eventName,
  Map<String, Object>? eventParams,
  List<String>? segmentationEventParamKeys,
) async {
  final args = <String, dynamic>{
    'eventName': eventName,
    'eventParams': eventParams,
    'segmentationEventParamKeys': segmentationEventParamKeys,
  };

  final success = await channel.invokeMethod<bool>('trackEvent', args);
  if (success == null || !success) {
    throw PlatformException(
      code: 'TRACK_EVENT_FAILED',
      message: 'Tracking event failed',
    );
  }
}