https://kotlinlang.org logo
#dagger
Title
# dagger
w

william

12/12/2018, 1:11 AM
If I have a constructor with default values how can I make it so dagger doesn't try and inject those fields?
g

gildor

12/12/2018, 2:12 AM
you cannot do this
Just create secondary constructor with only required values and annotate this constructor with @Inject annotation
w

william

12/12/2018, 2:14 AM
hmm ok thanks
g

gildor

12/12/2018, 2:16 AM
so this secondary constructor will delegate to primary and default field values will be used
t

tevjef

12/12/2018, 5:07 AM
g

gildor

12/12/2018, 5:15 AM
AssistedInject will not help with default arguments it has different use case
3
3 Views