Hi everyone! Is there a way to reuse the continuat...
# coroutines
s
Hi everyone! Is there a way to reuse the continuation in
suspendCoroutine
block?
Copy code
suspendCoroutine { continuation -> }
I need to call continuation more than once but its throwing error
Copy code
java.lang.IllegalStateException: Already resumed
        at kotlin.coroutines.SafeContinuation.resumeWith(SafeContinuationJvm.kt:44)
Any way to bypass this?
c
the continuation can only be used once. If you are trying to emit multiple values over time from a callback, you can use
callbackFlow
instead
s
Thanks! Will try that.
204 Views