Creating the Todo application
In this section, we’ll build a Todo application that relies on an InheritedWidget
– specifically, InheritedNotifier
– to share and modify a list of todos using a ChangeNotifier
. You will be able to create a Todo, mark it as completed, or delete it.
The starting point of this section is an application that already contains TodoController
, which we will be sharing with our InheritedNotifier
. Once we have dealt with InheritedWidget
and have a clear understanding of how everything works, we will move on to the Provider
exercise.
Using InheritedWidget for state management
Before we begin refactoring our starting application to use InheritedWidget
to share data, let’s get familiar with the process of sharing information by forwarding properties down the widget tree.
Starting with property passing
Open the main.dart
file; you will discover that we are creating our TodosController
and passing it into our TodosApp
: