Simina Nicolae
10/16/2026, 2:39 PM// 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:
val vm: SomeViewModel by viewModel { parametersOf("abc123") }
What I'd like to end up with (my best guess, not sure if correct):
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!