I am new to Kotlin/Coroutines, so hopefully I am just missing something/don\'t fully understand how to structure my code for the problem I am trying to solve.
Essen
Runblocking should mean you don't have to call join. Launching a coroutine from inside a runblocking scope should do this for you. Have you tried just:
fun processData(lstInputs: List): List {
val lstOfReturnData = mutableListOf()
runBlocking {
lstInputs.forEach {
launch(Dispatchers.IO) {
lstOfReturnData.add(networkCallToGetData(it))
}
}
}
return lstofReturnData