Mohamed Ibrahim
11/20/2020, 12:27 PMrepositoryContract.retrieveTopStories()
is a suspend function which returns List<Story>
why I can’t convert it to Flow by calling
repositoryContract.retrieveTopStories().asFlow()
John O'Reilly
11/20/2020, 12:36 PMelizarov
11/20/2020, 12:37 PMflow {
repositoryContract.retrieveTopStories()
.forEach { emit(it) }
}
John O'Reilly
11/20/2020, 12:43 PMfun main() = runBlocking {
val api = PeopleInSpaceApi()
api.fetchPeople().asFlow().collect {
println(it)
}
}
Chantry Cargill
11/20/2020, 1:02 PMgildor
11/20/2020, 2:29 PM