/// Adds [item] to cart. This and [removeAll] are the only ways to modify the
  /// cart from the outside.
  void add(Item item) {
    _items.add(item);
    // This call tells the widgets that are listening to this model to rebuild.

notifyListeners();
  }

  /// Removes all items from the cart.
  void removeAll() {
    _items.clear();
    // This call tells the widgets that are listening to this model to rebuild.

notifyListeners();
  }
}

The only code that is specific to ChangeNotifier is the call
to notifyListeners(). Call this method any time the model changes in a way
that might change your app’s UI. Everything else in CartModel is the
model itself and its business logic.