is it right that calling inject inside a Composabl...
# koin
a
is it right that calling inject inside a Composable that isnt inside a class that implements KoinComponent means i have to pass a class parameter, like so?
Copy code
val router by inject<RouterViewModel>(RouterViewModel::class.java)
ah i see, because KoinComponent's methods are inlined and KoinJavaComponent's arent
@Pedro Alberto i think this ^ is the reason
theres a way to inject directly, without
KoinComponent
, by using the methods on
KoinJavaComponent
. but its methods arent inlined so you need to pass the class parameter
p
am not sure why but maybe has to do with reflection stuff not sure.
but does it work with KoinComponent ?
a
yeah. i think the answer is that i simply have to swallow my pride and use the less nice looking function
yeah its fine with
KoinComponent
, tried it in another context
p
and you still need to use your way or this way works ?
val router by inject<RouterViewModel>()
cus I expect that with KoinComponent you don't have to use RouterViewModel::class.java
a
thats right
p
nice 🙂
a
KoinJavaComponent looks simple, feels like i could implement these functions for myself locally and inline them