I am using `Hilt` and I have a module setup like t...
# dagger
r
I am using
Hilt
and I have a module setup like this:
Copy code
@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:
Copy code
@Reusable
@OptIn(ExperimentalCoroutinesApi::class)
internal class ProviderService @Inject constructor(
  private val providerMap: Map<Int, Provider>,
)
I am getting this compile time error:
Copy code
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?
f
internal class ProviderService @Inject constructor( private val providerMap: Map<Int, @JvmSurpressWildCards Provider>, )
r
Thanks so much @FunkyMuse that makes sense!