You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, (Map<K, V>) is not working as expected with following setup:
Basically A1,A2 both implement A and I'm trying to inject both into factory constructor
@Binds @Prod @IntoMap @Key(A::class) fun prodA(prodA: A1): A
@Binds @Mock @IntoMap @Key(A::class) fun mockA(mockA: A2): A
class Factory @Inject constructor( @Mock private val mockMap: Map<Class<out A>, A>, @Prod private val prodMap: Map<Class<out A>, A> )
Error: [Dagger/MissingBinding] @Mock Map<Class<out A>, A> cannot be provided without an @Provides-annotated method.
FYI Map<Class<out A>, Provider<A>> is working as expected though
The text was updated successfully, but these errors were encountered:
According to the doc here: https://dagger.dev/dev-guide/multibindings for @Intomap
Then you can inject either the map itself (Map<K, V>) or a map containing value providers (Map<K, Provider<V>>).
However, (Map<K, V>) is not working as expected with following setup:
Basically A1,A2 both implement A and I'm trying to inject both into factory constructor
@Binds @Prod @IntoMap @Key(A::class) fun prodA(prodA: A1): A
@Binds @Mock @IntoMap @Key(A::class) fun mockA(mockA: A2): A
class Factory @Inject constructor( @Mock private val mockMap: Map<Class<out A>, A>, @Prod private val prodMap: Map<Class<out A>, A> )
Error:
[Dagger/MissingBinding] @Mock Map<Class<out A>, A> cannot be provided without an @Provides-annotated method.
FYI
Map<Class<out A>, Provider<A>>
is working as expected thoughThe text was updated successfully, but these errors were encountered: