aksh1618
01/18/2019, 5:11 PMgetAll
as suspend
? As currently it isn't required due to Room (Using LiveData<List>), but may be required if/when some other source of data is added?
2. Should the code to fetch data from server and populate Room's db be written in the Repository?jalexdev
01/18/2019, 11:24 PMLiveData
and coroutines (which I think is what you mean by suspend
) are different solutions to the same general problem which is to allow consumption of data in a non thread blocking manner and specifically in the Android world avoid blocking your main thread. So you would want to choose one and shouldn't need both.
2. I'd agree that Repository implementation is a good place to encapsulate any logic that pertains to how the data is sourced and/or maintained.