Dependency Injection with Koin |

Learn how to get started with the Dependency Injection framework Koin and how it can make developing CLEAN code and testing easier.

This is a companion discussion topic for the original entry at

Hello @kevindmoore,
thanks for great tutorial but I have a small remark video number 10 is the same as number 9. :wink:

Thanks for letting us know. It’s now been fixed.

i can not download any course material or starter project or i dont seen one

@nasim Please use the Download Materials button to download the sample project for each episode. I hope it helps!

Hi, I want to create 2 concrete clases, that implement an interface that has generic parameters

interface BaseDataToDomainMapper<out DomainModel, in DataModel> {
    fun toItem(item: DataModel): DomainModel
    fun toItems(dataList: List<DataModel>): List<DomainModel> { return emptyList() }

I want go provide 2 difference mappers that implement that interface, but koin do not let me
use generics to provide.

How can I do it to provide a MapperA, MapperB that implement BaseDataToDomainMapper ?
GrowerEntityWithProductLocationDomainMapper( get())
Should I use qualifiers named ? should I use the interface after the single ??
single<BaseDataToDomainMapper<GrowerEntityWithProductLocationItem, ProductLocationDao.GrowerEntityWithProductLocation>>(named(“GrowerEntityWithProductLocationDomainMapper”)){
GrowerEntityWithProductLocationDomainMapper( get())

Yes, I would use named items. Here is an example from my code:
val coroutines = module {
single (named(“Background”)) { Dispatchers.Default}
single (named(“IO”)) { Dispatchers.IO}
single (named(“UI”)) { Dispatchers.Main}

Then you can inject them with that named value you want

I can’t find the button to download the material :frowning:

Awesome course. So far I have always bounced back on DI but it just set me on the path. Grateful thanks for it.