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

knthmn

03/15/2021, 9:37 AM
I have a class that can be constructor injected, however if I want to install it in a specific component a also scope it, should I put it in a module and
@Provides
it?
f

FunkyMuse

03/15/2021, 10:01 AM
You can just scope that class @MyCustomScope MyClass @Inject constructor() same as you would with
@Singleton
k

knthmn

03/16/2021, 1:56 AM
Is it bad to provide it in a module even if it can be constructor injected, just for code organization? I want a single place that I can check the scopes of all my dependencies
f

FunkyMuse

03/16/2021, 9:09 AM
It's unnecessary to add it, also Dagger2 has a really good integration with Android studio where you can totally see where the dependencies are coming from, but if you want to do it, then do it, it's a preference at the end of the day.
3 Views