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

gumil

06/20/2020, 4:58 PM
Hello people, in hilt is there a way to differentiate modules to be installed in specific entrypoints only?
I would like to avoid
Copy code
@InstallIn(FragmentComponent::class)
in a module and it gets installed on every fragment i have in the app
a

Arun

06/20/2020, 6:39 PM
Currently this is possible only via a custom component defined with
@DefineComponent
.
installed on every fragment
this is an intentional design of hilt to have global binding space
the other way to scope it to specific fragment is to use
@Qualifiers
g

gumil

06/20/2020, 6:44 PM
hmm, then it would be easier not to use hilt then. Do you know the reason why hilt did it this way? I like the separation of modules between fragments.
r

Rafal

06/20/2020, 7:52 PM
https://dagger.dev/hilt/monolithic There is an explanation why hilt choosed a monolithic approach
2 Views