Repository
Repository is a pattern that helps developers keep code for data sources separate from activities and ViewModels. It offers centralized access to data that can then be unit tested:
In the preceding diagram, you can see the central role the repository plays in an application's code. Its responsibilities include:
- Keeping all the data sources (SQLite, Network, File System) required by your activity or the application
- Combining and transforming the data from multiple sources into a single output required at your activity level
- Transferring data from one data source to another (saving the result of a network call to Room)
- Refreshing expired data (if necessary)
Room, network layer, and FileManager
represent the different types of data sources your repository can have. Room may be used to save large amounts of data from the network, while the filesystem can be used to store...