https://kotlinlang.org logo
g

Gabriel

03/06/2021, 7:21 PM
I have a
composeable
inside a
navhost
that takes an arg as part of it's route, I can get it as part of the arguments passed to the composable, but when I try to get it from the viewmodel inside a
@Composable
it's not present, https://gist.github.com/gabriel403/61c149a491e7701314b6a895e1a48df0
i

Ian Lake

03/06/2021, 7:53 PM
You're not passing the arguments to your custom factory, so you're not passing it to the
AbstractSavedStateViewModelFactory
constructor: https://developer.android.com/reference/kotlin/androidx/lifecycle/AbstractSavedStateViewModelFactory#%3Cinit%3E(androidx.savedstate.SavedStateRegistryOwner,%20android.os.Bundle)
g

Gabriel

03/06/2021, 7:57 PM
Well, damn 🤦 Thanks @Ian Lake
i

Ian Lake

03/06/2021, 8:07 PM
Always something silly, don't worry about it