# coroutines

Mark McCormick

11/11/2020, 9:51 AM
Hello everybody Im struggling to find a way how to to deal with order of my coroutines. I have a dashboard with multiple items. After I load the items I load additional info for each item on the dashboard. Meanwhile I can click any item on the dashboard to show item’s detail. Currently the detail starts to load only after all the additional info on the dashboard is loaded, which is something I would like to change. Ideally, I would like to start loading detail info before dashboard is finished. It is an android app and Im using
for all the rest api calls. Do you have any suggestions? Thank you :)


11/11/2020, 9:55 AM
After I load the items I load additional info for each item on the dashboard
this is why you have to wait What you want is to pass the data back before all the coroutines finish. You can do that by: • a callback • a flow • a stateFlow/sharedFlow

Mark McCormick

11/11/2020, 10:05 AM
Thank you. I am using flow with room together to propagate the results to dashboard which works ok I think. But my main question is if I can somehow fetch detail immediately while there are requests for dashboard still being made. Something like putting the request for detail on top of the queue…
… or in parallel to dashboard requests…