1
0
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:
Brett Morgan
2019-12-18 10:54:58 +11:00
committed by GitHub
parent f6c3f889e6
commit d71180683c
24 changed files with 159 additions and 66 deletions

View File

@@ -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),
),
],