I have a module containing ``` @Provides @S...
# dagger
m
I have a module containing
Copy code
@Provides
    @Singleton
    fun providesMessageCenter(): MessageCenter = MessageCenter()
for me, this seems to be quite unnecessary and I guess I could annotate the
MessageCenter
class directly instead to get it into the graph. Whats the best way of doing this (or is the best way to keep it as it is?)
a
Copy code
@Singleton
class MessageCenter @Inject constructor()
should do the trick and you could remove the
@Provides
method.
m
@Inject is the only way of getting it to the graph?
a
Without a provision method, i.e @Provides or @Binds, @Inject is only the way to automatically add it to the graph.
m
ok, thanks