Ryan Smith
02/21/2023, 1:35 AMApkDataRepository
class to manage APK data, and the data source is just a private MutableStateFlow
property of the repository itself.
In trying to adhere to advice from different things I've read, my repository exposes the data as a Flow
and CRUD methods as suspending functions. IntelliJ is indicating that all of the suspend modifiers on my ApkDataRepository
functions are redundant so I'm feeling like I did something wrong there. I'm trying out another simple app and would like to learn from my past mistakes, so any advice or examples is appreciated.
I've considered that maybe suspending functions and Flow
are just overkill for such a simple app, but at the same time hope that it's possible to use contrived, low-complexity use cases like this to better understand coroutine and Flow concepts.Chris Fillmore
02/21/2023, 2:18 AMvalue
or update
is a synchronous operation, so suspend is not necessary there. Or do the suspend methods do something else, like work with files/db?Ryan Smith
02/21/2023, 2:39 AMMutableStateFlow.update
. I see now thats not a suspending function... so I suppose by the choice I've made there I've made suspend
on those functions unnecessary. I guess I could try a data source where CRUD operations work on files.