I would like to express a suspend function as a callback:
Copy code
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.