I would like to get rid of multiple get()
in Koin module definition in my code.
I have a few module definitions like this (of course this one is simplified and has dummy naming just for preview purposes):
val testModule = module {
viewModel {
TestViewModel(get(), get(), get(), testValue = true /* some external data */)
}
}
And TestViewModel
is like this:
class TestViewModel(
dep1: Application,
dep2: Application,
dep3: Application,
testValue: Boolean,
) : ViewModel()
I am aware of methods like:
val testModule = module {
viewModel {
new(::TestViewModel)
}
}
and:
val testModule = module {
viewModelOf(::TestViewModel)
}
But I haven't found a way to pass a value for testValue
in my constructor.