mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
flutter pub upgrade (#178)
This commit is contained in:
@@ -22,13 +22,13 @@ class MyApp extends StatelessWidget {
|
||||
providers: [
|
||||
// In this sample app, CatalogModel never changes, so a simple Provider
|
||||
// is sufficient.
|
||||
Provider(builder: (context) => CatalogModel()),
|
||||
Provider(create: (context) => CatalogModel()),
|
||||
// CartModel is implemented as a ChangeNotifier, which calls for the use
|
||||
// of ChangeNotifierProvider. Moreover, CartModel depends
|
||||
// on CatalogModel, so a ProxyProvider is needed.
|
||||
ChangeNotifierProxyProvider<CatalogModel, CartModel>(
|
||||
initialBuilder: (context) => CartModel.empty(),
|
||||
builder: (context, catalog, previousCart) =>
|
||||
create: (context) => CartModel.empty(),
|
||||
update: (context, catalog, previousCart) =>
|
||||
CartModel(catalog, previousCart),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user