https://kotlinlang.org logo
Title
a

Alfred Lopez

06/28/2021, 2:13 AM
Hi, if you have several classes that implement an interface, which one is instantiated with inject<MyInterface>? And how can I instantiate a particular one?
What I’m also trying to achieve is reading these classes from a properties file. This is for a multiplatform project. I realize there’s no *KClass.fo*rName in Kotlin.
p

Pcorbella

02/10/2023, 9:46 PM
Sorry to be so late. If there are several classes implementing an interface, it will give you a compilation error unless you mark one or both implementations with an @ForEnvironment("someName") Then you could inject it by inject<MyInterface>("someName")