Using dagger for the first time I have a doubt com...
# dagger
m
Using dagger for the first time I have a doubt coming from Koin. I have a viewmodel which requires a param by constructor:
Copy code
class UserDetailsViewModel(private val userId: String) : ViewModel() { ... }
With Koin I could inject it in my fragment/activity like this:
Copy code
class UserDetailsFragment : Fragment() {
  private val viewModel: UserDetailsViewModel by lifecycleScope.viewModel(parametersOf(
    requireArguments().getString(USER_ID)
  ))
}
How can I achieve this with Dagger/Hilt?
a
@ViewModelInject
j
arguments doesn't work ootb, but there are examples about it inside codelabs or Android doc web
👍 1
m
I’ve been reading a bit and I saw that you can retrieve intent extras through the
savedStateHandle
injected with
@Assist
Is this recommended or is there any other way?