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 Developer at LeanCode and a developer educator, he is set on helping other people succeed in their Flutter app development career.

You may also like

Flutter UI Testing with Patrol

Flutter UI Testing with Patrol
  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
    >