Module intro
Notes
The habit tracking app is only useful if we can save the tasks' data on some form of storage.
Before we can code anything, we need to answer some questions:
- Should we use a local or a remote data store to save our data?
- What kind of database or storage solution do we need (NoSQL or SQL-based)?
- What state management solution should we use?
This section will focus entirely on local data storage with Hive.
The next section will focus on state management with Riverpod.
We will use Hive & Riverpod, but the data & storage requirements of our app are relatively simple.
So we could choose different packages if we wanted to (as long as we go with something stable and battle-tested).
What does matter is that we structure our application following some important coding principles.
We'll ensure a good separation of concerns so that:
- we won't keep any business logic or any data persistence code inside our widget classes.
- any code that is not UI-related goes into a class that defines a domain-specific interface for how we can interact with the data-persistence layer.
Benefits:
- Code is better organized
- More testable
- Easier to swap out 3rd party packages with different ones if we want to
0 comments