Docs

Koin

Pragmatic dependency injection.

What is Koin

Koin is a lightweight DI framework configured with a readable Kotlin DSL — no annotations or codegen.

Install

gradle
kotlin
implementation("io.insert-koin:koin-core:4.0.0")

Usage

kotlin
kotlin
val appModule = module {
    single { UserRepository() }
    factory { UserService(get()) }
}

startKoin { modules(appModule) }

Docs

Official documentation: Koin.