Rooparsh
06/04/2021, 10:35 AMOmar Miatello
06/04/2021, 10:50 AMRooparsh
06/04/2021, 10:53 AMOmar Miatello
06/04/2021, 11:15 AMhiltViewModel()
the ViewModel is retained only inside your current screen.
Take a look on this example (from doc):
// import androidx.hilt.navigation.compose.hiltViewModel
@Composable
fun MyApp() {
NavHost(navController, startDestination = startRoute) {
composable("example") { backStackEntry ->
// Creates a ViewModel from the current BackStackEntry
// Available in the androidx.hilt:hilt-navigation-compose artifact
val exampleViewModel = hiltViewModel<ExampleViewModel>()
ExampleScreen(exampleViewModel)
}
/* ... */
}
}
Rooparsh
06/04/2021, 11:32 AMAlbert Chang
06/04/2021, 1:44 PMthan_
06/04/2021, 2:03 PM@Immutable
for your state data classes.Rooparsh
06/04/2021, 2:29 PMthan_
06/04/2021, 2:44 PMthan_
06/04/2021, 2:46 PMthan_
06/04/2021, 2:47 PMthan_
06/04/2021, 2:48 PMthan_
06/04/2021, 2:50 PMthan_
06/04/2021, 2:51 PMRooparsh
06/04/2021, 2:53 PMthan_
06/04/2021, 2:54 PMthan_
06/04/2021, 2:55 PMthan_
06/04/2021, 2:55 PMvm.dispatch(Action.SomeAction(someArgument))
than_
06/04/2021, 2:56 PMColton Idle
06/04/2021, 7:58 PMRooparsh
06/05/2021, 3:36 AM