https://kotlinlang.org logo
#koin
Title
# koin
c

Colton Idle

10/23/2023, 5:31 AM
How do I provide an interface, but give it a concrete class, and then use that interface in another provider? example
Copy code
single(createdAtStart = true) { ConcreteRandomNameGenerator() }

  single(createdAtStart = true) {
    val random: InterfaceRandomNameGenerator = get()
    val foo = Foo.init(random.getRand()).build()
    foo
  }
I'm currently getting a crash saying that
No definition found for type InterfaceRandomNameGenerator
j

Jonas

10/23/2023, 5:33 AM
Copy code
single<InterfaceRandomNameGenerator> { ConcreteRandomNameGenerator() }
there you go 🙂
❤️ 1
2