What are the other use cases of the repository class?
I know its used for getting Data from the server or cache but what else is the repository used for?
I’m using the MVVM pattern and wonder where to put I/O operations like saving and writing a file.
I also have a coin system in my app and I need to access that coin int from every screen in my app (settings, profile, home etc), is the Repository a good place to put it?
Saving and writing files should be treated as writing local DB or external data source. It's your data layer. Your repository should do same operations as before, and use FileService type of classes for it.
05/10/2022, 2:56 PM
it's more of a consolidation of different sources of data, remote, cache, local etc. Your repo would or should provide easy access to data from different sources as well as make it easy to modify (if needed) those data sources.
05/16/2022, 10:59 AM
Repository is just the new name for "Manager" in the Android world, so they can do literally anything and everything
05/16/2022, 9:17 PM
According to Martin Fowler a repository is characterized by an entity container to cache your obtained entities. Also one repository class only handles one entity, e.g. FirmwareRepository obtains only "FirmwareModel"s. There is no other use case for it