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

tseisel

06/17/2019, 2:07 PM
What's the difference between
Copy code
flow<String> {
    emit("Foo")
}
and
Copy code
channelFlow<String> {
    send("Foo")
}
Apart from the receiver, that is
FlowCollector
in the first and
ProducerScope
in the second.
j

jw

06/17/2019, 2:09 PM
A
channelFlow
allows you to
send
from any thread/context. A
flow
can only emit on the same context.
💯 3
s

streetsofboston

06/17/2019, 2:19 PM
I thought is was even more ‘strict’: A
flow
can only emit on the same scope (coroutine-scope).
👍 1
5 Views