I'm migrating DI from Koin to Dagger Hilt. I have a custom interface with many implementations, and I want to inject all the instances in a useCase as a list.
For example:
@Singleton
class MyUseCaseImpl @Inject constructor(
private val myInterfaces: List<MyInterface>,
) : MyUseCase {
...
}
When I used Koin, I would do:
single<MyUseCase> {
MyUseCaseImpl(
myInterfaces = getKoin().getAll(),
)
}
How can I do the same with Hilt?
I've already binded each implementation with my interface like:
@Binds
abstract fun bindFirstMyInterfaceImpl(
firstMyInterfaceImpl: FirstMyInterfaceImpl,
): MyInterface