Open Zhuinden opened 4 years ago
It also begs the question, how to use AbstractSavedStateViewModelFactory
to get a SavedStateHandle
into a ViewModel
provided by the Toothpick ViewModelBinding.
Should be a separate issue, though (and now it is: https://github.com/stephanenicolas/toothpick/issues/410 ).
Interesting, will do some research and target 4.0.
Thanks for the issue!
We just need to update toothpick.smoothie.viewmodel.ViewModelProvider
to use the new API for androidx...ViewModelProvider
:
https://developer.android.com/reference/androidx/lifecycle/ViewModelProvider
It takes a ViewModelStoreOwner
as a constructor param, it will make it work with this use case and simplify TP code as well.
This is a problem, because Jetpack Navigation allows for the creation of NavGraph-scoped ViewModels, bound to the lifecycle of a NavBackStackEntry.
Toothpick should be able to support this scenario.