title: How does the Provider Interface used in ViewModel Factory works?
body: <p>Recently, I've been reading all over the internet about how to inject ViewModels using Dagger. The most common approach is to create a factory to delegate the creation of the ViewModel. Below is likely the code for the factory:</p>
  <pre><code>@Singleton
  class MainViewModelFactory @Inject constructor(
      private val creators: Map&lt;Class&lt;out ViewModel&gt;, @JvmSuppressWildcards Provider&lt;ViewModel&gt;&gt;
  ) : ViewModelProvider.Factory {
      override fun &lt;T : ViewModel&gt; create(modelClass: Class&lt;T&gt;): T {
          val creator = creators[modelClass] ?: creators.entries.firstOrNull {
              modelClass.isAssignableFrom(it.key)
          }?.value ?: throw IllegalArgumentException(&quot;unknown model class $modelClass&quot;)
  
          @Suppress(&quot;UNCHECKED_CAST&quot;)
          return creator.get() as T
      }
  }
  </code></pre>
  <p>But I can't fully understand the parameter of the factory:</p>
  <pre><code>private val creators: Map&lt;Class&lt;out ViewModel&gt;, @JvmSuppressWildcards Provider&lt;ViewModel&gt;&gt;
  </code></pre>
  <p>What exactly is this <code>Provider</code> interface? And how does this work?
  Also, what is the <code>@JvmSuppressWildcards</code> annotation for?</p>