Creating a repository and a TodoItem model
Any good architecture always involves abstraction. In this app, we need something to store and retrieve the items of our to-do list. Later, these will be stored in a SQLite database, but adding a reference to the database directly in the code that is responsible for the GUI is generally a bad idea as it tightly couples your data storage implementation to the UI layer, making it harder to test your UI code independently from the database.
So, what we need is something to abstract our database from the GUI. For this app, we’ve chosen to use a simple repository pattern. This repository is simply a class that sits between the SQLite database and our upcoming ViewModel
class. This is the class that handles the interaction with the view, which, in turn, handles the GUI.
The repository will expose methods for getting, adding, and updating items, as well as events that allow other parts of the app to react to changes in the repository...