https://kotlinlang.org logo
Title
d

Daniele B

06/16/2021, 9:09 AM
I would like to express a suspend function as a callback:
suspend fun getMyObject() : MyObject {
   ...
   return myObject
}

val myApp = myCallback { myObject ->
   /* code using myObject */
}
how should I write the function
myCallback
?
k

Kirill Gribov

06/16/2021, 9:29 AM
just curious, why do you need to express suspend fun as callback? The main idea of Kotlin coroutines was to replace callback hell with coroutines and suspend functions.
d

Daniele B

06/16/2021, 9:40 AM
c

CLOVIS

06/16/2021, 4:45 PM
Don't spam multiple channels.