File tree Expand file tree Collapse file tree 2 files changed +6
-8
lines changed
examples/state_mgmt/simple/lib/src
src/docs/development/data-and-backend/state-mgmt Expand file tree Collapse file tree 2 files changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -16,14 +16,13 @@ class CartModel extends ChangeNotifier {
1616 /// An unmodifiable view of the items in the cart.
1717 UnmodifiableListView <Item > get items => UnmodifiableListView (_items);
1818
19- /// The current total price of all items (assuming all items cost $1 ).
20- int get totalPrice => _items.length;
19+ /// The current total price of all items (assuming all items cost $42 ).
20+ int get totalPrice => _items.length * 42 ;
2121
2222 /// Adds [item] to cart. This is the only way to modify the cart from outside.
2323 void add (Item item) {
2424 _items.add (item);
25- // This call tells [Model] that it should rebuild the widgets that
26- // depend on it.
25+ // This call tells the widgets that are listening to this model to rebuild.
2726 notifyListeners ();
2827 }
2928}
Original file line number Diff line number Diff line change @@ -217,14 +217,13 @@ class CartModel extends [!ChangeNotifier!] {
217217 /// An unmodifiable view of the items in the cart.
218218 UnmodifiableListView<Item> get items => UnmodifiableListView(_items);
219219
220- /// The current total price of all items (assuming all items cost $1 ).
221- int get totalPrice => _items.length;
220+ /// The current total price of all items (assuming all items cost $42 ).
221+ int get totalPrice => _items.length * 42 ;
222222
223223 /// Adds [item] to cart. This is the only way to modify the cart from outside.
224224 void add(Item item) {
225225 _items.add(item);
226- // This call tells [Model] that it should rebuild the widgets that
227- // depend on it.
226+ // This call tells the widgets that are listening to this model to rebuild.
228227 [!notifyListeners!]();
229228 }
230229}
You can’t perform that action at this time.
0 commit comments