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
allan.conda
10/13/2020, 7:10 PM
@ViewModelInject
j
Javier
10/13/2020, 7:17 PM
arguments doesn't work ootb, but there are examples about it inside codelabs or Android doc web
👍 1
m
Miguel Coleto
10/14/2020, 7:12 AM
I’ve been reading a bit and I saw that you can retrieve intent extras through the