我正在从这里上课:https ://dagger.dev/tutorial/07-two-for-the-price-of-one
当我更改代码时
@Module
abstract class HelloWorldModule {
@Binds
abstract fun helloWorldCommand(command: HelloWorldCommand): Command
}
Run Code Online (Sandbox Code Playgroud)
进入
@Module
abstract class HelloWorldModule {
@Binds
@IntoMap
@StringKey("hello")
abstract fun helloWorldCommand(command: HelloWorldCommand): Command
}
Run Code Online (Sandbox Code Playgroud)
我收到错误:
error: [Dagger/MissingBinding] Map<String,? extends Command>
cannot be provided without an @Provides-annotated method.
Run Code Online (Sandbox Code Playgroud)
我在这里缺少什么?它在 Kotlin 上不起作用吗?