Matheus Matos
06/14/2023, 5:37 PMrunBlocking
in KMM it works fine on android, but it crashes on iOS. In short i just need to run an async function in a non-async one:
fun getMyToken() {
return settings.getOrNull("ID_TOKEN") ?: runBlocking {
return@runBlocking getMyTokenAsync()
}
}
suspend fun getMyTokenAsync(): String {
return httpRequest...
}
Is it possible inside the shared library?Pablichjenkov
06/14/2023, 5:53 PMMatheus Matos
06/14/2023, 6:05 PMMatheus Matos
06/14/2023, 6:13 PMPablichjenkov
06/14/2023, 7:39 PMMatheus Matos
06/15/2023, 6:16 PMCoroutineScope(Dispatchers.Main + Job())
. However, I still need to use a callback to know when suspend/async task finishes.Pablichjenkov
06/15/2023, 7:13 PMsuspendCancelableCoroutine