I am trying to access my room database viewModel in a Repo file rather than a Composable, because I want to use some data in my MainViewModel. I am getting a mismatch when trying to access the viewModel. What could I be doing wrong? It works absolutely fine when I call it within a Composable.
I'm getting this: "Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public inline fun <reified VM : ViewModel> ComponentActivity.viewModels(noinline factoryProducer: (() → ViewModelProvider.Factory)? = ...): Lazy<TypeVariable(VM)> defined in androidx.activity"