Summary
In this chapter, we looked at the different ways to persist user data locally. We learned why data persistence is required and what options are available in Flutter to persist data. Finally, we implemented SharedPreferences and HiveDB in our application to persist data. We started by creating a service class that deals with shared_preferences
or HiveDB to save and retrieve data using the plugins. Then we followed the MVVM pattern that we discussed in Chapter 6, Architecting and Organizing, to create a view model and implement the functionality to save data using the service class we defined. This way, it keeps code well organized and maintainable.
In the next chapter, we will learn about state management, which is one of the most important techniques as your application state starts getting complex. We will learn about different state management options and implement one of them. See you in the next chapter!