aipok
02/24/2020, 8:15 PMGlobalContext.get().koin.inject()
in 2.1.0 for Android?
I found KoinContextHandler.get()
or getKoin()
that works the same way, but which is expected to be used as replacement?arnaud.giuliani
02/25/2020, 8:29 AMarnaud.giuliani
02/25/2020, 8:30 AMKoinContextHandler
help us specify the kind of context we want. On Android/JVM we have the GlobalContext
arnaud.giuliani
02/25/2020, 8:30 AMaipok
02/25/2020, 8:31 AMKoinContextHandler.get()
is the way to go if I’m using Kotlin for Android?arnaud.giuliani
02/25/2020, 8:32 AMarnaud.giuliani
02/25/2020, 8:33 AMaipok
02/25/2020, 8:34 AMMark
02/26/2020, 4:29 AMGlobalContext.get().koin
to KoinContextHandler.get()
but now I get No root scoped initialized
exception. Any ideas why?Mark
02/26/2020, 4:32 AMstartKoin{}
returns. However, it worked in 2.0.1
My workaround is to move the loadKoinModules()
calls from within startKoin{}
to immediately afterwards. Is that the right approach?arnaud.giuliani
02/26/2020, 8:22 AMMark
02/26/2020, 8:23 AMarnaud.giuliani
02/26/2020, 8:24 AMMark
02/26/2020, 8:26 AMstartKoin{}
I call various init()
methods (you may remember I mentioned this before) corresponding to different android library modules. An init()
method will do stuff like loadKoinModules()
This was working fine in 2.0.1arnaud.giuliani
02/26/2020, 8:29 AMMark
02/26/2020, 8:30 AMMark
02/26/2020, 8:31 AMarnaud.giuliani
02/26/2020, 8:46 AMperhaps the root scope should be set earlier,when do you have a a problem with roto scope?
Mark
02/26/2020, 8:47 AMKoinContextHandler.get().get<X>()
does not work until startKoin{}
has completed?arnaud.giuliani
02/26/2020, 9:01 AMarnaud.giuliani
02/26/2020, 9:02 AMMark
02/26/2020, 9:03 AMKoinContextHandler.get()
is not exactly the equivalent of GlobalContext.get().koin
?arnaud.giuliani
02/26/2020, 9:04 AMarnaud.giuliani
02/26/2020, 9:04 AMMark
02/26/2020, 9:06 AMarnaud.giuliani
02/26/2020, 9:11 AMarnaud.giuliani
02/26/2020, 9:21 AM