salomonbrys
09/25/2017, 1:02 PMby
when using a KodeinInjector
, because whatever you are retrieving, it won't be retrieved before you actually give the injector a kodein instance with inject(kodein)
, hence the use of property delegates (that do not retrieve but register the need to retrieve), hence the use of by
.
- The Parameter specified as non-null is null
error comes from the Kotlin's order of initialization. It's a Kotlin "bug" (that is not really a bug). In that case, Kotlin tries to initialize the parent values before the children (which is the expected order of init), but because you have a value that is initialized in the parent (kodein
) that needs a value initialized in the child class (module
), well, it fails 🙂 That's why you should never use child values or methods in the initialization or constructor of a parent class. In this case, I suspect using val kodein by Kodein.lazy {
will correct the issue 🙂
- Kodein does not support async loading, that's an idea I'll explore 😉