title: How to add data to List in MutableLiveData?
body: <p>I want to add an item to a <code>List</code> of <code>MutableLiveData</code> in <code>ViewModel</code>.</p>
  <p><code>List</code> is <code>read-only</code> because it was initialized with <code>listOf()</code>.</p>
  <p>But in a specific case I want to add an item.</p>
  <p>To do this, I used <code>toMutableList()</code> to <code>type cast</code>, but as a result of debugging, there was no change in the <code>List</code> of <code>LiveData</code>.</p>
  <p>How can I apply data to a <code>List</code> of <code>LiveData</code>?</p>
  <pre><code>class WriteRoutineViewModel : ViewModel() {
      private var _items: MutableLiveData&lt;List&lt;RoutineModel&gt;&gt; = MutableLiveData(listOf())
  
      val items: LiveData&lt;List&lt;RoutineModel&gt;&gt; = _items
  
      fun addRoutine(workout: String) {
          val item = RoutineModel(workout, &quot;TEST&quot;)
          _items.value?.toMutableList()?.add(item) // nothing change
      }
  }
  </code></pre>