title: What does the constructor do in the @HiltViewModel
body: <p>I am attempting to add Hilt DI to a view model class.</p>
  <ol>
  <li><p>It's not clear to be from the docs (in layman's terms) what the constructor is used for?</p>
  </li>
  <li><p>All the Google docs also indicate you need to add this : ViewModel interface after the constructor but I am also curious what purpose that interface serves?</p>
  </li>
  </ol>
  <pre><code>@HiltViewModel
  class MyViewModel @Inject constructor(
  
  ) : ViewModel() {
      private val _myVal: MutableState&lt;String&gt; = mutableStateOf(&quot;&quot;)
      val myVal get() = _myVal.value
  
      fun setMyVal (myVal: String) {
          _myVal.value = phoneNumber
      }
  }
  </code></pre>