main.dart file ChangeNotifierProxyProvider having issues builder method is not defined.
ChangeNotifierProxyProvider<Auth, Orders>(
builder: (ctx, auth, previousOrders) => Orders(
auth.token,
auth.userId,
previousOrders == null ? [] : previousOrders.orders,
),
),
ChangeNotifierProxyProvider<Auth, Products>(
create: (_) => Products('', '', []),
update: (_, auth, prevProducts) {
return Products(
auth.token,
auth.userId,
prevProducts == null ? [] : prevProducts.items,
);
},
),
Their is no argument like builder in ChangeNotifierProxyProvider, that’s why you are getting that error.
In ChangeNotifierProxyProvider you have to provide create, update and child.
Here, in create you can create your object and in update you can specify when to change provider's value, when notifier depends on some other model.
ChangeNotifierProxyProvider<MyModel, MyChangeNotifier>(
create: (_) => MyChangeNotifier(),
update: (_, myModel, myNotifier) => myNotifier
..update(myModel),
child: ...
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With