如何将产品添加到颤抖中的购物车?
我有产品地图列表,我想在ONTAP上将该产品添加到购物车页面。
我有产品地图列表,我想在ONTAP上将该产品添加到购物车页面。
我想在购物车页面中添加这些产品当用户点击“喜欢的按钮”时..... 在此处输入图像描述
I have the list of map of product and i want to add that product to cart page on ontap .
I have the list of map of product and i want to add that product to cart page on ontap .
I want to add those products in cart page when user tap the favourite button.....
enter image description here
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用Flutter shared_preferences package。调用共享preferences为异步函数,以保存数据使用
setStringList()
获取保存数据用户
getsTringList()
函数notes:
setStringStringList (“ Cartproducts”,Data);
- Cartproducts是保存数据的名称,使用该数据相同获取数据。data
是您的列表< map< string,dynamic>>多变的。listItems
- 将其用作设置数据getCartProducts()
inInitstate()
中的变量Use flutter shared_preferences package. Call SharedPreferences as async function, to save the data use
setStringList()
To get save data user
getStringList()
functionNotes:
setStringList("cartProducts", Data);
- cartProducts is name for to saved data use the same to get data.Data
is your List<Map<String, dynamic>> variable.listItems
- use this as a variable to set the datagetCartProducts()
ininitState()
您需要使数据成为对象,存储数据,然后将数据发送到购物车页面。
data.dart
在MAIN中创建数据对象后,当您单击购物车图标时,将数据保存在随机列表中。
最后,我们将数据发送到Cartpage。
另外,您可以使用
提供商
软件包进行更方便的管理。You need to make the data an object, store the data, and then send the data to the Cart Page.
data.dart
After creating a data object in main, when you click the shopping cart icon, the data is saved in a random list.
Finally, we send the data to the CartPage.
Alternatively, you can use the
Provider
package for more convenient management.