In the last episode we made a Retrofit service to fetch data from the weather API. We also used Gson to convert this data from JSON to Kotlin objects.

We could technically use only this Retrofit service and create a nice user interface to display all the data we are currently getting. Doing this wouldn’t be really performant and efficient though. What if the user doesn’t have an internet connection? Do we even really need to fetch data from the server every time the app is launched? Shouldn’t we cache all of this data?

The answer is YES! In this tutorial you are going to learn how to create a local SQLite database using the Room library. By the end of this tutorial, you will understand terms like entity or data access object (dao).

?Get the code from this tutorial?


About the author 

Matt Rešetár

Matt is an app developer with a knack for teaching others. Working as a Flutter freelancer and most importantly developer educator, he doesn't have a lot of free time 😅 Yet he still manages to squeeze in tough workouts 💪

You may also like

Search Bar in Flutter – Logic & Material UI

Flutter Integration Test Tutorial + Firebase Test Lab & Codemagic

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}