你好,我一直在尝试进入我的列表,即名称购物车,这就是我的 Firestore 的样子: 这是代码:
我如何尝试获得它:
Cannot convert value of type 'WritableKeyPath<MyObject, String?>' to expected argument type 'WritableKeyPath<MyObject, Any>'
我正在尝试但我无法做到但我无法做到 这是我的订单管理员:
class Orders extends StatelessWidget {
@override
Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context);
return Scaffold(
appBar: AppBar(
elevation: 10.0,
backgroundColor: Colors.pink[100],
title: Image.asset(
"images/logo.png",
scale: 14.0,
),
centerTitle: true,
),
backgroundColor: Colors.white,
body: Padding(
padding: const EdgeInsets.all(15.0),
child: ListView.builder(
itemCount: userProvider.allOrders.length,
itemBuilder: (_, index) {
OrderModel _order = userProvider.allOrders[index];
return Column(
children: [
Divider(
thickness: 2,
),
Expanded(
flex: 2,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
CustomText(
text: _order.cart[index].name, color: Colors.green),
IconButton(
icon: Icon(
Icons.credit_card,
color: Colors.green,
),
)
并且我的购物车模型与我的 firestore 中的图片具有相同的属性,如何访问它?