Closed arjun1194 closed 3 years ago
Paging is Coroutine-first and there isn't any need to use LiveData if you are using Flow. However, you can still use LiveData via the LiveData extensions from paging-runtime
.
Instead of observing Pager(..).flow
, you want Pager(...).liveData
. https://developer.android.com/reference/kotlin/androidx/paging/package-summary#extension-properties
The general recommendation I have though is to try to keep your app consistent to always use LiveData
or always use Flow
when possible.
https://github.com/googlecodelabs/android-paging/blob/b249ec89ffd92773dcff2443da1f803c39784122/app/src/main/java/com/example/android/codelabs/paging/ui/SearchRepositoriesViewModel.kt#L34
Im trying to learn Paging 3.0 and want to know why you have not used Live Data in the view model in this project, also How would we go about using Live data along with paging 3 library. thanks!