We have already created a Retrofit service, WeatherNetworkDataSource as an abstraction on top of that service, local database with entities and DAO using the Room library and lastly a repository to rule them all. So, technically speaking, we currently have the model layer done. What’s missing to have a functioning MVVM application is precisely the ViewModel and the View.

In this part we’re going to implement them so that we’ll have the architecture all setup and prepared for adding a nice user interface. You are going to learn how to perform a lazy loading with coroutines in Kotlin, how to connect ViewModel to a repository, how to safely call coroutines from a lifecycle-bound component such as a Fragment and much more!

?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 💪 and guitar 🎸

You may also like

Flutter Custom & Staggered Page Transition Animation Tutorial

Flutter Firebase & DDD Course [5] – Sign-In Form Logic

  • i m facing problem with kodeinAware on override val kodein by closestKodein() as i write above line of code i m getting error which shown below but this is not the case with you?
    can you please hint what the issue is.

    Missing ‘getValue(CurrentWeatherFragment, KProperty)’ method on delegate of type ‘KodeinPropertyDelegateProvider’

    Please Reply
    ThankYou!

    Reply

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