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

svenjacobs

09/05/2019, 10:47 AM
What is the difference between
channelFlow
and
callbackFlow
? Both have the same signature except latter is
inline
. Is this the only difference?
d

Dominaezzz

09/05/2019, 11:09 AM
They even have the same implementation.
You supposed to use
callbackFlow
for setup up a flow wrapper for callback-based listeners and such.
s

svenjacobs

09/05/2019, 11:10 AM
And why am I supposed to use
callbackFlow
in this case and not
channelFlow
? 😉
d

Dominaezzz

09/05/2019, 11:10 AM
And use
channelFlow
when you find yourself needing concurrent
emit
.
👍 1
s

streetsofboston

09/05/2019, 11:53 AM
Yeah, it seems the names are different based on intent, not on implementation 😀
s

svenjacobs

09/05/2019, 11:56 AM
So both functions are interchangeable regardless of the use case?
👌 1
d

Dominaezzz

09/05/2019, 1:11 PM
Pretty much.
7 Views