Ismaïl
03/26/2023, 5:27 PMsuspendCoroutine works, I tried to implement an example, here is the GitHub Gist link
Does this code make sense ? it works but I was wondering if it can be improved somehow
Thanks in advancefranztesca
03/26/2023, 5:43 PMcoroutineScope { launch(IO) { ... } }
Is not really idiomatic. It does the same as
withContext(IO) { ... }
Also, IO context is used to bridge blocking code to suspend functions. In your case, you are using an asynchronous function underneath, so there is no need of the IO context, so no need of the withContext tooIsmaïl
03/26/2023, 5:48 PMwithContext doesn’t create a CoroutineScope, does it ?
If it doesn’t, then coroutineScope is better, so we have children coroutines and not sibling.
Am I wrong ?franztesca
03/26/2023, 6:24 PMsendRequestAndPrintResultSuspendable, because you can just call the other suspending function directly.