You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val myModule = module {
// Will match types ServiceImp & Service
single { ServiceImp() } bind Service::class
}
Note here, that we would resolve the Service type directly with get(). But if we have multiple definitions binding Service, we have to use the bind<>() function.
and I did found an old stackoverflow with what near outcome of what I want.
Describe the bug
Multiple classes sharing the same interface should be able to be called.
To Reproduce
Steps to reproduce the behavior:
getKoin()
andget<ClassName>()
failsgetKoin()
and unable to find the.bind<>()
Expected behavior
Be able to bind the same interface with multiple classes
Koin module and version:
koin-core 4.1.0-Beta1
Snippet or Sample project to help reproduce
https://insert-koin.io/docs/reference/koin-core/definitions/#additional-type-binding
Note here, that we would resolve the Service type directly with get(). But if we have multiple definitions binding Service, we have to use the bind<>() function.
and I did found an old stackoverflow with what near outcome of what I want.
https://stackoverflow.com/a/60508841/14859274
But instead I want to be able to get the AValidator
since in the project I was using, we were using delegate interface
and wanted to call them by their class name.
The text was updated successfully, but these errors were encountered: