Austin Nelson
12/14/2021, 1:58 AMandroidx.hilt:hilt-navigation-compose
to 1.0.0-beta01
I am now getting this error:
You cannot access the NavBackStackEntry's ViewModels until it is added to the NavController's back stack (i.e., the Lifecycle of the NavBackStackEntry reaches the CREATED state).
But I commented out all of my ViewModel stuff and it's still erroring out. Can anyone explain what changed?
This is basically all I have:
SwipeDismissableNavHost(
navController = navController,
startDestination = "start",
modifier = Modifier.background(MaterialTheme.colors.background)
) {
composable("start") {
// val mainViewModel = hiltViewModel<MainViewModel>()
// val uiState = mainViewModel.uiState.collectAsState()
Box(
modifier = Modifier.fillMaxSize(),
contentAlignment = Alignment.Center
) {
Text("uiState.value")
}
}
}
Ian Lake
12/14/2021, 2:09 AMAustin Nelson
12/14/2021, 2:11 AM