config
Declares the loaded config of type T (root or nested spec) as a Koin single.
The value is read from Konstant when it is first injected, so the module can be declared before Konstant.init<Spec> runs, as long as init happens before anything injects it.
val configModule = module {
config<AppConfig>()
config<DatabaseConfig>()
}
class UserRepository(private val db: DatabaseConfig)
val dataModule = module { singleOf(::UserRepository) }Content copied to clipboard