You can use either in terms of achieving the same functionality. I originally began with LiveData, than refactored the Repositories to Flow, and now am using mostly Flow.

I outlined the Model-View-Intent (MVI) pattern with Flow in Android Model-View-Intent with Kotlin Flow.

  • 🏞️ May 2019 — Unidirectional Data Flow (UDF) with LiveData
  • 🍂 Nov. 2019 — UDF w/ LiveData + Flow
  • 🏖️ July 2020 — MVI + UDF with Flow

The preference I have for Flow in the ViewModel layer is it reduces the complexity of the MVI pattern. Complexity may vary depending on the specific architecture pattern used.

Additional complexity remains due to the need for a mutable and immutable view state class. Again, because LiveData is bound to a view’s lifecycle, a mutable view state cannot be initiated and observed in the ViewModel as with Flow or RxJava Subjects. As a workaround, the mutable view state adds values in the ViewModel, and the immutable view state is observed directly by the view instead of being emitted in the ViewModel through an interface contract like withFeedView.

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