track static method

void track(
  1. String eventName, {
  2. Map<String, dynamic> properties = const {},
})

Implementation

static void track(String eventName,
    {Map<String, dynamic> properties = const {}}) {
  if (properties != {}) {
    final jsConstructor = globalContext['Object'] as JSFunction;
    final propertiesObj = jsConstructor.callAsConstructor() as JSObject;
    properties.forEach((key, value) {
      propertiesObj[key] = value;
    });
    plotlineFunc?.callAsFunction(
        null, "track".toJS, eventName.toJS, propertiesObj);
  } else {
    plotlineFunc?.callAsFunction(null, "track".toJS, eventName.toJS);
  }
}