epool
06/23/2020, 12:17 AM@InstallIn(ApplicationComponent::class)
@Module
abstract class ViewModelModule1 {
@Binds
@IntoMap
@ViewModelKey(VM1::class)
abstract fun bindVM1(vm1: VM1): ViewModel
}
@InstallIn(ApplicationComponent::class)
@Module
abstract class ViewModelModule2 {
@Binds
@IntoMap
@ViewModelKey(VM2::class)
abstract fun bindVM2(vm2: VM2): ViewModel
}
and merge them to inject them as a single map in a constructor like
@Inject constructor(private val creators: Map<Class<out ViewModel>, @JvmSuppressWildcards Provider<ViewModel>>)
I’m trying to use hilt and when I
@InstallIn(ApplicationComponent::class)
in both modules above I have an error message saying that the map dependency is duplicated. In advance thanks!