CartItem.fromMap constructor
Creates a CartItem from a Firestore document map.
Parameters:
- map: A Map<String, dynamic> containing the cart item's data.
Returns: A CartItem instance populated with the map's data.
Implementation
factory CartItem.fromMap(Map<String, dynamic> map) {
return CartItem(
productId: map['productId'],
productName: map['productName'],
price: map['price'].toDouble(),
quantity: map['quantity'],
unit: map['unit'],
imageUrl: map['imageUrl'],
farmerId: map['farmerId'],
);
}