sendEvent static method

Future<void> sendEvent(
  1. String eventName,
  2. Map<String, String> eventProperties
)

Sends an event with the specified eventName and eventProperties.

This method invokes the native method sendEvent.

Throws a PlatformException if the event sending fails.

eventName: The name of the event to send. eventProperties: A map of properties associated with the event.

Implementation

static Future<void> sendEvent(
    String eventName, Map<String, String> eventProperties) async {
  const platform = MethodChannel('mergnKotlinSDK');
  try {
    await platform.invokeMethod('sendEvent',
        {"eventName": eventName, "eventProperties": eventProperties});
  } on PlatformException catch (e) {
    print("Failed to send event: '${e.message}'.");
  }
}