在探索 Kodein 时,我遵循https://proandroiddev.com/dependency-injection-with-kotlin-kodein-koin-3d783745e48d中的示例
val diModel = Kodein.Module {
bind<TasksRepository>() with singleton {
FakeTasksRepository()
}
}
我得到了错误
Type inference failed. Expected type mismatched:
required: KodeinBinding<in ???, in ???, out TaskRepository>
found: (Mutable)set<(() -> FakeTaskRepository)!>!
怎么了?
仅供参考,我使用 kodeIn 版本6.4.0
补充一下,我已经尝试过来自https://kodein.org/di/的示例
val businessModule = Kodein.Module {
bind<IService>() with singleton { BusinessService() }
}
同样的事情也会发生。我做错什么了吗?或者文档已经过时了?