https://kotlinlang.org logo
Title
v

Vlad Makarenko

05/18/2023, 10:26 AM
Hello, I am using Koin annotations and here is my scenario. I have a repository in my view model. This repository accepts an injected parameter. However, when I try to pass the POJO to the view model through the
parametersOf
function, it crashes on startup. The crash displays the following message:
Caused by: org.koin.core.error.DefinitionParameterException: No value found for type 'com.example.example.example.SamplePojo'.
There’re code samples:
@Single(binds = [SomeRepo::class])
class SomeRepoImpl(
    @InjectedParam private val pojo: SamplePojo,
    private val service: SomeServiceService,
): SomeRepo {
...
fun getData() = ...
...
...
val viewModel = koinViewModel<SomeVM>(
    key = key
) {
parametersOf(SamplePojo(key))
}
...
@KoinViewModel
class SlidesVM(
    private val getData: GetDataUseCase
) : ViewModel()
@Factory
class GetDataUseCase(
    private val someRepo: SomeRepo
) {

    operator fun invoke() = someRepo.getData()
}