Elye
Elye

Reputation: 60311

How to pass parameter for Kodein Injected instances?

In Kodein, when I have the below binding

    bind<AppDependent>() with singleton {
        AppDependent("abc", instance(), instance())
    }

I could get my appDependent using below

private val appDependent : AppDependent by instance(

However if I like to provide the title as below

    bind<AppDependent>() with multiton {
        title: String -> AppDependent(title, instance(), instance())
    }

How could I create appDependent?

I tried something as below but not working.

private val appDependent : AppDependent by instance("Main")

Upvotes: 1

Views: 532

Answers (1)

Elye
Elye

Reputation: 60311

Found that we could do it as below

private val appDependent: AppDependent by instance(arg = "My Text")

Upvotes: 1

Related Questions