-
Notifications
You must be signed in to change notification settings - Fork 0
Dagger β Some theory about component relationship
Devrath edited this page Oct 8, 2023
·
1 revision
Contents |
---|
How Consumer gets object references in Dagger |
How Consumer gets object references in Dagger |
Relationship between components |
- In a
dagger
there can be multiplecomponents
and theconsumer
might have to get the objects from all the components - So whatever the requirements of the
consumer
, Theconsumer
requests from correspondingcomponents
. - The component finds the object(if exists) and provides it from
@Inject
annotated constructor or from a@Module
. - The
component
could be defined at anapplication level
,activity level
, orfragment level
.
- Now the
consumer
can request in such a way that, Say consumer requests some object references from a fragment component, and the fragment component can request some object references from an application component. - Thus there can be a relationship between the components and thus a dependency.
- Now finally the fragment component will be the one that gives the references to the
consumer
.