I am struggling with flutter ecommerce cart data structure for firebase , what is the right way to structure the data?
for now I am structuring it someting like this on firebase :
cart_items = [
{
"id": 144,
"created_at": "2019-04-04 14:42:04",
"updated_at": "2019-04-04 14:42:04",
"cart_id": "3",
"client_id": "83",
"product_id": "6",
"quantity": "1",
"price": "1500",
"name": "Cucumber (2Pcs)",
"image": "products/es4eGjkgQ6MvzTaMyX4iXWjcSX03mVk3QB9oODWk.jpeg",
},
{
"id": 145,
"created_at": "2019-04-04 14:42:09",
"updated_at": "2019-04-04 14:42:09",
"cart_id": "3",
"client_id": "83",
"product_id": "5",
"quantity": "1",
"price": "2000",
"name": "Cauliflower",
"image": "products/lVZ31zORzltyVIDXhHoCWUgjTlal7cWd7pI8DL2V.jpeg",
}
]
But the problem with this is I am not able to update the quantity field of the product.
question from:
https://stackoverflow.com/questions/65902351/how-to-structure-data-for-flutter-cart-flutter 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…