https://kotlinlang.org logo
#koin
Title
# koin
s

spechard

02/07/2023, 9:13 PM
Hi all, How do you pass parameters to a scope? I can define like this:
Copy code
scope(named<Example>()) {
    scoped { params -> Example(name = params.get()) }
}
but how do I resolve the instance in the scope afterwards? Thanks!
1
Found it! It is not documented (or I didn’t find it), but if anyone needs it:
Copy code
val example = scope
    .inject<Example> { parametersOf("first") }
    .value
a

Adam Brown

02/07/2023, 11:06 PM
oo I was looking for exactly that!
a

arnaud.giuliani

02/09/2023, 8:11 AM
if you use ìnject().value, replace it directly with get() then
9 Views