【发布时间】:2021-01-26 13:33:15
【问题描述】:
我正在为 firebase 的颤振电子商务购物车数据结构而苦苦挣扎,构建数据的正确方法是什么?
现在我在 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",
}
]
但问题是我无法更新产品的数量字段。
【问题讨论】:
-
"我无法更新产品的数量字段。"为什么不?是什么阻止你这样做?一般来说,如果您在问题中包含minimal code that reproduces where you got stuck,您将在 Stack Overflow 上获得更好的帮助。遵循该链接中的指导会大大增加有人提供帮助的机会。
-
好吧,我无法更新 quantity 字段,因为它存在于地图中,而地图中存在于数组中。
标签: firebase flutter dart google-cloud-firestore