Do we have a way to inject parameters from argumen...
# compose
v
Do we have a way to inject parameters from arguments inside viewmodel from compose navigation with hilt? For example, I have parameter, that I pass and I have
Copy code
val viewmodel: ViewModel = hiltViewModel()
How do I pass a parameter from arguments to constructor?
j
You don't pass arguments to the hiltViewModel() function, instead, inject an instance of SavedStateHandle into your viewModel: https://developer.android.com/jetpack/compose/libraries#hilt You can than get your navigation arguments from there.
v
thank you!
143 Views