Hello, I am using Koin annotations and here is my ...
# koin
v
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:
Copy code
@Single(binds = [SomeRepo::class])
class SomeRepoImpl(
    @InjectedParam private val pojo: SamplePojo,
    private val service: SomeServiceService,
): SomeRepo {
...
fun getData() = ...
...
Copy code
...
val viewModel = koinViewModel<SomeVM>(
    key = key
) {
parametersOf(SamplePojo(key))
}
...
Copy code
@KoinViewModel
class SlidesVM(
    private val getData: GetDataUseCase
) : ViewModel()
Copy code
@Factory
class GetDataUseCase(
    private val someRepo: SomeRepo
) {

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