guys, what is the best way to wait all results of ...
# coroutines
m
guys, what is the best way to wait all results of async calls inside a for loop ?
a
create a list of the async calls and use awaitAll
m
sth like this:
Copy code
val list = it.map { async { ... } }
and then
Copy code
awaitAll()
n
if you have a loop, just do the loop within a coroutineScope
the scope will not exit until all the jobs are done
g
You cannot get result if you just run and forget in coroutineScope.
awaitAll is correct solution
n
oh right, they mentioned the result.. derp