When a user adds a product to their shopping cart in your mobile app, signifying their intent to purchase a specific item.
import'package:antsomisdk/antsomi.dart'; // Contains Antsomi SDK APIsimport'package:antsomisdk/cdp_event.dart'; // Contains the CDPEvent class';final event =CDPEvent(en:'add_to_cart_product');List<Map<String, dynamic>> items = [];// Build event data// Replace with your objectfinal productDetail = value['product'] asProduct;items.add({'type':'product','id': productDetail.sku ??'','name': productDetail.name ??'','sku': productDetail.sku,'price':double.tryParse(productDetail.salePrice ??''),'original_price':double.tryParse(productDetail.price ??''),'quantity': value['quantity'] asint,});// Include the Multiple-Objects (items) in the event dataevent.items = items;// Set the Customer Objects to the event dataevent.setCustomerProps = {'customers': { 'name': user.name ??'','customer_id':MD5Hash().generateMd5(user.email ??''), }};// Include more Event Attributes (extra) in the event dataaddToCartEvent.eventProps = {'event_source':'add_to_cart','cart_subtotal': cartModel.getTotal() ??0.0,'cart_item_count': cartModel.totalCartQuantity};// Initialize AntsomiSDK objectantsomiSdk =Antsomi();// Send the event data to CDPantsomiSdk.track(event: event);