title: Get single item from Room DB. Call the function from view model
body: <p>So my general question is how to call a function from view model for @Query where you have to pass something and then return something.
  My simple example:</p>
  
  <p><strong>DAO</strong></p>
  
  <pre><code>@Query ("SELECT * FROM table_name WHERE id = :id LIMIT 1")
  fun getItemById (id: Long) : MyItem
  </code></pre>
  
  <p><strong>Repo</strong></p>
  
  <pre><code>fun getItemById (id: Long) : MyItem {
  return itemDao.getItemById(id)
  }
  </code></pre>
  
  <p>I know that it cannot and should not be done on ui thread. For inserting and deleting an item i use viewModelScope job but i cannot (maybe just don`t know how to) use it to return anything.
  If i return it everywhere as LiveData, then it works just like that:</p>
  
  <p><strong>ViewModel</strong></p>
  
  <pre><code>fun itemById(id: Long): LiveData&lt;MyItem&gt; {
   return itemRepo.getItemById(id)
  }
  </code></pre>
  
  <p>And then i observe it in a Fragment/Activity:</p>
  
  <pre><code>viewModel.itemById(id).observe(this, Observer {
   // using it
  })
  </code></pre>
  
  <p>The thing is, that i dont really need it to be an observable livedata. I only need to get it once, check condition and thats it.
  So maybe someone could recommend how to do it, without it being a livedata. Or should i leave it a live data?</p>