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

Luis Munoz

07/05/2019, 5:10 PM
How do I wrap some callback inside an async or suspend function so I can return my own value. This is what I'm trying ....
s

streetsofboston

07/05/2019, 6:04 PM
Take a look at (Google) calling
suspendCancellableCoroutine { continuation -> ... }
. This call will suspend and the lambda with the
continuation
. You can use this continuation in your callbacks.
l

Luis Munoz

07/05/2019, 8:56 PM
thanks
d

dekans

07/07/2019, 9:50 AM
You can also use
callbackFlow { }
for this purpose.
3 Views