trackEcommerceOrder method
Implementation
Future<String> trackEcommerceOrder({
required String identifier,
required String grandTotal,
required List<EcommerceProduct> products,
String? subTotal,
String? tax,
String? shippingCost,
String? discount,
}) async {
var arguments = <String, dynamic>{};
arguments['identifier'] = identifier;
arguments['grandTotal'] = grandTotal;
arguments['subTotal'] = subTotal;
arguments['tax'] = tax;
arguments['shippingCost'] = shippingCost;
arguments['discount'] = discount;
final ecommerceProducts = [];
products.forEach((product) {
final productMap = <String, dynamic>{};
productMap['sku'] = product.sku;
productMap['category'] = product.category;
productMap['price'] = product.price;
productMap['quantity'] = product.quantity;
productMap['name'] = product.name;
productMap['brand'] = product.brand;
productMap['variant'] = product.variant;
productMap['customDimensions'] = product.customDimensions;
ecommerceProducts.add(productMap);
});
arguments['products'] = ecommerceProducts;
final result = await _channel.invokeMethod(trackEcommerceOrderName, arguments);
return result;
}