title: Dagger Hilt with multiple implementations of an interface
body: <p>With Dagger2 it's easy to explicitly create components and list their dependencies. But I can't seem to find a way to provide different implementations of an interface to lets say a fragment.</p>
  <p>For example, my app has 2 production modes: paid and free.
  I have a PaidActivity and a FreeActivity, both of which start exactly the same Dashboard fragment with an Analytics class. For Paid I provide a PaidAnalytics implementation, for Free I provide a FreeAnalytics implementation.</p>
  <p>With Dagger2 it's easily achieved by just listing a Paid or a Free Module in the Activity's Component (or Subcomponent).</p>
  <pre><code>@Module
  abstract class FreeActivityModule {
  
      @ContributesAndroidInjector(
          modules = [
              FreeAnalyticsModule::class,
              DashboardFragmentModule::class
          ]
      )
      abstract fun injectFreeActivity(): FreeActivity
  
  }
  
  @Module
  abstract class PaidActivityModule {
  
      @ContributesAndroidInjector(
          modules = [
              PaidAnalyticsModule::class,
              DashboardFragmentModule::class
          ]
      )
      abstract fun injectPaidActivity(): PaidActivity
  
  }
  
  @Module
  abstract class DashboardFragmentModule {
  
      @ContributesAndroidInjector
      abstract fun injectDashboardFragment(): DashboardFragment
  
  }
  
  class DashboardFragment : Fragment() {
  
      ...
  
      @Inject
      lateinit var analytics: Analytics
  
      ...
  
  }
  
  </code></pre>
  <p>With Dagger Hilt I couldn't find a way to do this.</p>