Open shmaltorhbooks opened 1 month ago
Same issue here.
val appModule = module {
singleOf(::MovieRepository)
singleOf(::UpdateMovieUseCase) { bind<UseCase<List<MovieDomainModel>>>() }
singleOf(::EditMovieUseCase) { bind<UseCase<EditMovieDomainModel>>() }
}
// This does not work
val updateUseCase = koinInject<UseCase<List<MovieDomainModel>>>()
// This works
//val updateUseCase = koinInject<UpdateMovieUseCase>()
val editUseCase = koinInject<UseCase<EditMovieDomainModel>>()
println(updateUseCase)
println(editUseCase)
Will both print 6478-6478 System.out I com.example.composetest.EditMovieUseCase@554e934 6478-6478 System.out I com.example.composetest.EditMovieUseCase@554e934
The issue is when not the implementation is requested but rather the abstraction (interface).
Describe the bug When I trying to bind multiple instances to different generic interfaces
I<T>
, koin returns all instances ofI
ignoring generic type<T>
Koin module and version:
koin-core:3.5.6
Snippet or Sample project to help reproduce