1 min read

Daily Dispatch #6 - Dependency Injection KodeIN-DI

Daily Dispatch #6 - Dependency Injection KodeIN-DI

So I went on to learn more about dependency injection by trying to change an example project that used Koin to use KodeIN-DI now.

Some problems were found, where I didn’t know what the equivalent to “get()”(from koin) to Kodein.

Eventually I found out it was “instance()”. And the way to declare things seemed simple enough.

Let’s see some examples where I’ll put the koin and kodein code side by side.

single { get<AppDatabase>().employeeDao() } //---> koin
bindProvider {
   instance<AppDatabase>().employeeDao() //----> kodein

It isn’t much, but I had loads of errors building the project that are unrelated to di. Maybe tomorrow I’ll have more luck.