I am creating a news app to fetch the news from newsAPI.
I have to use StateFlow. Should I create a stateFlow object in repository interface implementation or View model ?? Do I have to make ViewModel collect it and pass on to view ? I am bit confused as to how the process should look like. Can anyone please help ?
not kotlin but kotlin colored 1
👍 1
s
Suhaib Kazi
04/16/2024, 6:18 AM
If you are collecting from an API its usually one-shot op. So a flow doesnt make sense in repo layer.
Collect the wrapper object of your response using any flow in your VM