Hi. I wonder if this looks like a valid way to cal...
# multiplatform
a
Hi. I wonder if this looks like a valid way to call suspend function from within commonMain:
Copy code
class TestClass {
    private val dispatcher = CoroutineScope(Dispatchers.Main + SupervisorJob())
    
    fun someAction() {
        //do something
        dispatcher.launch {
            requestWithKtor()
        }
    }
    
    suspend fun requestWithKtor() {
        //do some networking
    }
}
g
Just about naming, your val
dispatcher
is a CoroutineScope, not a Dispatcher, naming maters. (Otherwise it seems ok to me but I'm not a coroutine user.)