CPSC270A
Software Eng & Project Design

Activity 13

Count State

Create a Flutter app with two tabs that communicate via state.

Details

The app should build off of the app from the last activity by adding the following:

  1. the class CountModel that extends ChangeNotifier, defined in a separate file, that represents the number of times the button has been pressed. The class should define a mutator method increment that modifies the model’s state and notifies listeners.

  2. a ChangeNotifierProvider to the parent widget.

  3. a Consumer widget to the tab that displays the count.

  4. a call to the Provider.of function in the button tap handler to update the model without rebuilding the button.

Example