R Brian Amesbury
03/31/2022, 5:10 PMHilt
and I have a module setup like this:
@Module
@InstallIn(SingletonComponent::class)
abstract class DomainModule {
...
@Binds
@IntoMap
@IntKey(1)
@Reusable
internal abstract fun bindsFirstProvider(impl: FirstProvider) : Provider
@Binds
@IntoMap
@IntKey(2)
@Reusable
internal abstract fun bindsSecondProvider(impl: SecondProvider) : Provider
}
I am trying to inject the map into a class like this:
@Reusable
@OptIn(ExperimentalCoroutinesApi::class)
internal class ProviderService @Inject constructor(
private val providerMap: Map<Int, Provider>,
)
I am getting this compile time error:
error: [Dagger/MissingBinding] java.util.Map<java.lang.Integer,? extends com.example.Provider> cannot be provided without an @Provides-annotated method.
What am I missing to get this to work?FunkyMuse
03/31/2022, 10:56 PMR Brian Amesbury
04/01/2022, 9:23 PM