I am trying to upgrade my java code to kotlin but I don’t know how to aproach this transition. It seems that I have to perfectly understand corutines which is a pain because it seems too much all at once just to make a decision how to start.
To summarize my app have two ArrayList
/**
This array must update exactly every minute from db(room) or retrofit
The array itself usually does not change but the size of it does (objects inside can change).
*/
val schedulesArray ArrayList
/**
Objects in this array should updates whenever the db(room) changes
The array size can change (objects can be added or removed)
*/
val channelsArray ArrayList
My question is strictly about what should I use to efficiently implement corutines: Flow or suspend or StateFlow…
Should I pass the entire array to this Flow, StateFlow … and modify it later when I need it or should I create thousand of these for each object inside array.
How can I modify the array inside eg. StateFlow later when needed?
Where should I iterate the array? ModelView or Repository?