salomonbrys
03/09/2018, 2:23 PMdirect
in kodein.direct
is an extension function, it exists, but not within the Kodein
class. In fact, you'll see that almost everything, regarding the Kodein
class, is an extension function.
Also, to retrieve a dependency without using a property, there are 2 solutions:
- Use `direct`: val dep: Whatever = direct.instance()
- Use a local delegated property (which are supported since Kotlin 1.1) : val dep: Whatever by direct.instance()
. Here, the dep
declaration is a value declaration inside a function, not a property of a class 😉