https://kotlinlang.org logo
#flow
Title
e

enighma

02/07/2020, 7:43 PM
A noob question: What I want to do: Setup a producer flow, so that I can dynamically offer events depending on some external source. It looked like a
callbackFlow
should solve my problem so I created something like:
Copy code
val c = callbackFlow<Model> {}
However, it looks like I can only offer events from within the lambda, and I want to do something like
c.offer(X)
Am I thinking about producer/consumer wrong? I guess one other approach is to create a
channel
and then turn it into a flow. Just trying to figure out what is the more idiomatic approach. Thanks!