sendGenericEvent static method

void sendGenericEvent(
  1. String code,
  2. Map<String, dynamic> attributes
)

Sends a generic (custom) event with code and attributes to the Netmera. Use this for events that are not pre-defined in NetmeraEvent.

Implementation

static void sendGenericEvent(String code, Map<String, dynamic> attributes) {
  final processedAttrs = attributes.map<String, dynamic>((key, value) {
    if (value is DateTime) {
      return MapEntry(key, value.millisecondsSinceEpoch);
    } else if (value is List<DateTime>) {
      return MapEntry(
        key,
        value.map((date) => date.millisecondsSinceEpoch).toList(),
      );
    }
    return MapEntry(key, value);
  });
  _platform.invokeMethod(_sendGenericEvent, {"code": code, "attributes": processedAttrs});
}