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

yassir kazzoune

01/06/2022, 10:32 AM
Can someone explain to me this part from Hilt Documentation (https://developer.android.com/training/dependency-injection/hilt-android#component-default): "Each Hilt component comes with a set of default bindings that Hilt can inject as dependencies into your own custom bindings. Note that these bindings correspond to the general activity and fragment types and not to any specific subclass. This is because Hilt uses a single activity component definition to inject all activities. Each activity has a different instance of this component."
a

Arun

01/06/2022, 11:13 AM
Hilt promotes monolith components, meaning all activity, fragment or any other type is bound in a single large component. So when we have multiple activities we don't have binding for each activity like LoginActivity/HomeActivity instead all of them are bound as Activity (the super type).
👍 2
4 Views