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

Luis Munoz

03/11/2020, 8:24 PM
What is the proper way make a call back that is called multiple times into a flow? similar to this but that gets called ony once: https://stackoverflow.com/questions/48552925/existing-3-function-callback-to-kotlin-coroutines/48562175#48562175
obviously what I wrote wont' work, it gives handle is not suspend function error
s

streetsofboston

03/11/2020, 8:29 PM
Use
callbackFlow
instead of
flow
and at the end of the lambda you provide, call
awaitClose { … }
👍 1
6 Views