You don't control the default extras for a
NavBackStackEntry
(just like how you don't control the default factory either). While it didn't make it into this alpha01 release, expect two approaches going forward:
1.
viewModel()
that takes
CreationExtras
, in addition to the factory (thus allowing you to provide your own
CreationExtras
to your custom factory)
2. A new
viewModel()
overload that takes a lambda method to construct the ViewModel:
val viewModel: HomeViewModel = viewModel {
// Directly reference any value without having
// to worry about a Factory or CreationExtras
HomeViewModel(valueFromComposition, repository)
}
You can technically write those both yourself right now (as the underlying APIs that you need are already there)