Koin parameters

Providing dynamic values to bean definitions

Parameters are dynamic values that can be passed to bean definitions.

Using parameters in definitions

In your bean definition, just use the lambda parameter like follow:

val simpleModule = applicationContext {

        factory { params -> ComponentA(params[PARAM_URL]) }

Parameters are stored in a Map (Key/Value), and can be easily retrieved with params[<YOUR KEY>]

Providing parameter values

Providing values for parameters is very easy: just provide a map of values like follow:

 class MyComponent : KoinComponent {

        val compA: ComponentA by inject { mapOf(PARAM_URL to URL1) }