Vaios Tsitsonis
12/01/2022, 11:40 AMVaios Tsitsonis
12/01/2022, 12:52 PM@Composable
fun Screen(
vm: screenViewModel = viewModel()
)
By changing the code to inject viewmodels in the navgraph it worked...
@Composable
fun MyGraph(
vm: screenViewModel = viewModel()
) {
NavHost(...) {
composable(...) {
Screen(vm = vm)
}
}
}
@Composable
fun Screen(
vm: screenViewModel
)
Why does this happen? We are going to end-up with many ViewModels in the graph by doing that...Vaios Tsitsonis
12/01/2022, 1:27 PMhiltViewModel()
fixes that too...