Just had a weird behaviour on lint.
I have this module, but for some reason the cast as CarsRepository is declared not needed. But it’s actually mandatory otherwise at runtime the application crashes 😮
Copy code
val remoteModule = module {
factory { CarRemoteRepositoryImpl() as CarsRepository }
}
How can I debug this from Koin core side?
n
Nicolas Picon
07/19/2019, 11:28 AM
The cast is not needed because
CarRemoteRepositoryImpl
already is a
CarsRepository
.
I prefer using the following syntax to bind implementation to their interface:
Copy code
val remoteModule = module {
factory<CarsRepository> { CarRemoteRepositoryImpl() }
}