I have a Database entity and DTO and a domain mode...
# android
f
I have a Database entity and DTO and a domain model I mapped the network DTO to my domain model in a usecase that fetching a list of item Now I have another usecase that fetches from cache storage But would be observed in the same fragment as the first one which is the list of item form network Usecase 1 fetch from API Map to domain model observed in view in a recycler view Usecase 2 user saved a particular article to disk I then fetch from cache storage and observe in the same view in another recycler view My question is should I create a different domain model for that of cache Entity and for DTO Because in the view model I have a UI state For example
Copy code
data class UIState(
val itemlist = List<ItemEntity> = list of()
Val isLoading ......
)
If I update itemlist uiState with data fetched from network How can I differentiate it from data fetch from cache because I need these distinctive data in 2 different recycler view
It been resolved I just need to use a single source of truth I just didn't think of this