Daniele B
suspend fun getMyObject() : MyObject { ... return myObject } val myApp = myCallback { myObject -> /* code using myObject */ }
myCallback
wbertan
block
myApp
String
MyObject
suspend fun getMyObject(): String { return "something" } suspend fun myCallback(block: suspend (String) -> String): String { return block(getMyObject()) } val myApp = myCallback { myObject -> myObject }
getMyObject
suspend fun myCallback(block: suspend (String) -> Unit): String { return getMyObject().also { block(it) } } val myApp = myCallback { myObject -> // do something with myObject }
DKMPViewModel.getWebInstance()
Suspend function 'myComposeApp' should be called only from a coroutine or another suspend function
streetsofboston
runBlocking { ...}
suspend fun main()
CLOVIS
A modern programming language that makes developers happier.