Junior — Middle
What is the role and purpose of the scope component in the context of using Dagger for dependency injection?
sobes.tech AI
Answer from AI
In Dagger, scope (lifetime and scope of dependencies) is defined by annotations like @Singleton, @ActivityScope, etc. When a component and its dependencies are annotated with a scope, it indicates that objects with this scope are created once and reused within the component. This controls object lifetime, e.g., singleton at application level or unique objects at activity level. An example with @Singleton is provided in the original text.