title: Proper way to pass LiveData in ViewModel taken from suspended Repository
body: <p>I'm wrapping my head around Kotlin coroutines and LiveData. I want to do really basic use case where ViewModel returns LiveData taken from Repository suspended function, which returns LiveData as well.</p>
  
  <p>Repository function signature: </p>
  
  <pre><code>suspend fun getAll() : LiveData&lt;List&lt;Mountain&gt;&gt; 
  </code></pre>
  
  <p>It can't simply do that:</p>
  
  <pre><code>fun getMountains() : LiveData&lt;List&lt;Mountain&gt;&gt; {
    return mountainsRepository.getAll()
  }
  </code></pre>
  
  <p>because the compiler states that suspend function should be called from coroutine or another suspend function. 
  I came up with 2 ugly solutions, but I know they aren't elegant: </p>
  
  <p><strong>1 Solution with runBlocking</strong> </p>
  
  <pre><code>fun getMountains() : LiveData&lt;List&lt;Mountain&gt;&gt; = runBlocking { mountainsRepository.getAll() }
  </code></pre>
  
  <p><strong>2 Solution with nullable LiveData</strong> </p>
  
  <pre><code>fun getMountains() : LiveData&lt;List&lt;Mountain&gt;&gt;?{
      var mountains : LiveData&lt;List&lt;Mountain&gt;&gt;? = null
      viewModelScope.launch{
          mountains = mountainsRepository.getAll()
      }
      return mountains
  }
  </code></pre>
  
  <p>How can I do this properly?</p>