single<ObserveLifeCycleState> {
Communicator(
domain = get(),
repositoryMessanger = get()
)
}
single<NewMessageListener> {
Communicator(
domain = get(),
repositoryMessanger = get()
)
}
As you can see I am instantiating the same 2 objects because it implements both interfaces. But this creates 2 different objects. How can I do it with only one initialization?
I believe single { Communicator(...) }.binds(ObserveLifeCycleState::class, NewMessageListener::class) should do it
Most helpful comment
I believe
single { Communicator(...) }.binds(ObserveLifeCycleState::class, NewMessageListener::class)should do it