Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumKotlinFlow cold streamsSingle-choice MCQ

An operator chain ends with a terminal collect. Where does the upstream flow{} block actually run, regarding the dispatcher?

import kotlinx.coroutines.* import kotlinx.coroutines.flow.* suspend fun demo() { flow { emit(1) } .map { it * 2 } .flowOn(Dispatchers.IO) .map { it + 1 } .collect { println(it) } }