<How to cache room data in View Model?> In my Andr...
# stackoverflow
r
How to cache room data in View Model? In my Android app, I fetch data from the room database and display it on the UI. I am caching mapped data. Is this the correct way to cache data in the View Model? I am new to Android, please correct me if I am wrong. I am switching dispatcher using withContext, do we need to switch? @HiltViewModel class TrainVM @Inject constructor( private val repo: Repository, // Inject the repository private val apiRepo: KtorRepo ) : ViewModel() { private var localSchCache =...