Reputation: 163
From Fragment, I'm calling one viewmodel fun and inside that I written this piece of code, but it's not printing anything! Only "Hello called" is printing.
Code:
fun fetchUserReviewData1() {
LogUtils.d("Hello called")
flow {
(1..5).forEach {
LogUtils.d("Hello UserReviewViewModel1 it: " + it)
// delay(100) //delay the emission
emit(it)
}
}.onEach { LogUtils.d("Hello UserReviewViewModel it: " + it) }
}
Upvotes: 0
Views: 1725