Hi all :wave: I'm migrating a Koin module from cla...
# koin
s
Hi all 👋 I'm migrating a Koin module from classic DSL to the new Safe DSL + Compiler Plugin version 1.2.1 (single<T>() / viewModel<T>() style) and I'm stuck on a pattern where the runtime parameter needs to be forwarded into two different nested dependencies. Simplified classic-DSL example:
Copy code
// Classic DSL — works today
viewModel { (id: String) ->
    SomeViewModel(
        infoService = get { parametersOf(id) },
        dataService = get { parametersOf(flowOf(id)) },
    )
}

class SomeViewModel(
    private val infoService: InfoService,
    private val dataService: DataService,
)

class InfoService(@InjectedParam val id: String)          // constructed via get { parametersOf(id) }
class DataService(@InjectedParam val idFlow: Flow<String>) // constructed via get { parametersOf(flowOf(id)) }
Usage at the call site:
Copy code
val vm: SomeViewModel by viewModel { parametersOf("abc123") }
What I'd like to end up with (my best guess, not sure if correct):
Copy code
class SomeViewModel(
    private val infoService: InfoService,
    private val dataService: DataService,
) : ViewModel()

// module
viewModel<SomeViewModel>()
Question: is it possible for the Compiler Plugin to resolve InfoService and DataService as ordinary graph dependencies of SomeViewModel, while InfoService/DataService themselves still need a runtime parameter (id, forwarded, and flowOf(id), transformed) that only becomes available when the ViewModel itself is requested with parametersOf(id)? Any guidance on how the above example should be handled would be much appreciated! Thanks!