Closed jsiefers closed 2 years ago
are you sure your injecting the repository param in your useCase?
private val myListUseCase: MyUseCase by inject()
->
@Factory
class MyUseCase(
@InjectedParam private val myRepository: MyRepository
)
Why do you need @InjectedParam
?
@arnaudgiuliani I think I misunderstood the @InjectedParam
annotation. I thought that was needed to let Koin know that that parameter should be injected. After removing it, I don't get the exception any more. Thanks for your reply.
Describe the bug After migrating from 'regular' implementation to annotations, I get the following exception (snippet):
Following the call stack in the debugger, leads me to the instantiation of my ViewModel. This project follows the principles of clean architecture and consists of multiple gradle modules (app, domain and data).
ViewModel (app module)
Use case (domain module)
MyRepository (domain module)
Implementation of MyRepository (data module)
Koin modules: (reside in their respective gradle modules, in the
di
subpackage)Starting Koin:
Additional information:
MyUseCase
(inKoinDomainModuleGen.kt
, I noticed that theparams
are empty, likely the cause of the exception. But I don't understand why the parameters are empty.Expected behavior All injected dependencies are resolved properly and no exception occurs
Koin project used and used version: koin-core and koin-android version:
3.2.0-beta-1
(api
in domain module, on which the other modules have a dependency) koin-annotations version:1.0.0-beta-2
(api
in domain module, on which the other modules have a dependency) ksp plugin version:1.6.20-1.0.5
(in all modules)