https://kotlinlang.org logo
#coroutines
Title
# coroutines
n

Nemanja Scepanovic

07/03/2020, 1:44 PM
Hi guys, would you say it’s necessary or unnecessary to change the dispatcher upon flatMapLatest’s transform?
Copy code
fun getBooksFlow: Flow<List<Book>> = 
     getUserFlow().flatMapLatest { user -> getUserBooksFlow(user.userId) }.flowOn(Dispatchers.Default)
g

gildor

07/03/2020, 2:03 PM
If function is not blocking and you don't do any heavy computations it's unnecessary to switch dispatcher
👍 1
4 Views