我得到了这个代码:
providers: [
ChangeNotifierProvider.value(
value: Auth(),
),
ChangeNotifierProxyProvider<Auth, Products>(
builder: (ctx, auth, previousProducts) => Products(
auth.token,
auth.userId,
previousProducts == null ? [] : previousProducts.items,
),
),
ChangeNotifierProvider.value(
value: Cart(),
),
ChangeNotifierProxyProvider<Auth, Orders>(
builder: (ctx, auth, previousOrders) => Orders(
auth.token,
auth.userId,
previousOrders == null ? [] : previousOrders.orders,
),
),
],
但它似乎已被弃用,并在hangeNotifierProxyProvider
行中出现以下错误:
The parameter 'create' is required.
The parameter 'update' is required.
我不知道如何升级这部分代码?
1条答案
按热度按时间eqqqjvef1#
我尝试了下面的代码,似乎它的工作,但我仍然不确定我做的对吗?