Flow docs mention that collection always happens i...
# coroutines
d
Flow docs mention that collection always happens in the "context of the calling coroutine". Does this mean that setting up flow and collecting it will happen on the same thread? I.e. is it safe to do read/write shared like this:
Copy code
suspend fun func() {
  var counter = 0
  someComplexFlow() // <-- potentially calls various withContext() inside its operators
    .collect { counter++ }
}
a
It may not be the same thread but the above code is safe
d
ah, yes, because only one thread at a time will be there