sendCustomEvent method

  1. @override
Future<void> sendCustomEvent(
  1. CustomEvent event
)
override

Implementation

@override
Future<void> sendCustomEvent(CustomEvent event) async {
  if (Platform.isIOS) {
    final payload = {
      "account_id": event.accountId,
      "flttr_ctm": jsonEncode({
        "add": {
          "locale": event.address?.locale,
          "country_code": event.address?.countryCode,
          "country_name": event.address?.countryName,
          "admin_area": event.address?.state,
          "locality": event.address?.city,
          "sub_locality": event.address?.neighborhood,
          "thoroughfare": event.address?.street,
          "sub_thoroughfare": event.address?.number,
          "postal_code": event.address?.postalCode,
          "address_line": event.address?.addressLine,
          "latitude": event.address?.latitude,
          "longitude": event.address?.longitude,
        },
        "base": {
          "ext_id": event.externalId,
          "evnt_tag": event.tag,
          "stts": event.status,
          "prop": _transformToStringMap(event.properties),
        },
      }),
    };

    await methodChannel.invokeMethod<void>('sendCustomEvent', payload);
  } else {
    await methodChannel.invokeMethod<void>('sendCustomEvent', {
      "accountId": event.accountId,
      "externalId": event.externalId,
      "tag": event.tag,
      "status": event.status,
      "address":
          event.address != null ? _parseEventAddress(event.address!) : null,
      "properties": event.properties,
    });
  }
  return;
}