Sometimes I just use livedata for all, is it bad or wrong

Thank you for the question Jimmy leo. My first implementation of UDF used only LiveData. Technically this pattern worked, but is not optimal. LiveData is launched from the view lifecycle and requires the view to observe the LiveData in order for data to be emitted from the cold observable.

You may run into issues with processes that are not directly related to the view and are launched from the business logic layer (ViewModel). In addition, if there is a logic flow launched from the view, and additional transformations need to be applied, switchMap's are required to return data prior to being observed in the view with LiveData. This can get complicated for more advanced transformations and merging data with MediatorLiveData, whereas with Kotlin Flows you can launch directly from the ViewModel and use the built-in operators to transform the data in a linear and readable format.

Creator of Coinverse - The 1st Crypto News Audiocast App @ bit.ly/play-coin

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store