hi i try to learn more about coroutine flows and i...
# coroutines
j
hi i try to learn more about coroutine flows and i try to emulate the equivalent of rx throttleLatest i get confused about switching context for producer and consumer coroutines channels. can someone point me into a direction where to look for it? most flow/channel tutorials don't take callbacks into considerations that are not a suspend function, e.g. i can't call emit() in a callback for some reason
l
You're probably looking for
callbackFlow
or
channelFlow
. Beware that
offer
can throw when the flow collection is cancelled.
👍 1
z
In particular, you can use the
buffer
and
conflate
operators immediately after those two builders to configure the buffer size of the channel they use.
👍 1