why is this ```fun intervalFlow(delayMillis: Long...
# coroutines
u
why is this
Copy code
fun intervalFlow(delayMillis: Long): Flow<Int> {
    return flow {
        withContext(Dispatchers.Default) {
            var i = 0
            emit(i)
            while (true) {
                delay(delayMillis)
                emit(++i)
            }
        }
    }
}
wrong -- I mean I read the article, but at runtime it doesnt crash, and printing threads in each step, seems correct
l
It's explained in the docs. Solution is to use
flowOn
or replace
flow
with
channelFlow
.