<@U0VPVCYFP> commented on <@U0BNGCVCK>’s file <htt...
# coroutines
u
@defhlt commented on @deviant’s file https://kotlinlang.slack.com/files/U0BNGCVCK/F4DPDLC4T/callbacks_to_coroutines.kt: If you it's one value or error, you don't need channels:
Copy code
suspend fun fetchDataAsync() = suspendCoroutine { c: Continuation<Any> ->
val listener = object : Listener {
            override fun onSuccess(value: Any) {
              c.resume(value);
            }

            override fun onError(throwable: Throwable) {
              c.resumeWithException(throwable);
            }

}
// add listener ...
}
(edited)