title: How to get the value of a Flow outside a coroutine?
body: <p>How can I get the value of a Flow outside a coroutine similarly to LiveData?</p>
  
  <pre><code>// Suspend function 'first' should be called only from a coroutine or another suspend function
  flowOf(1).first()
  </code></pre>
  
  <pre><code>// value is null
  flowOf(1).asLiveData().value
  </code></pre>
  
  <pre><code>// works
  MutableLiveData(1).value
  </code></pre>
  
  <p><strong>Context</strong></p>
  
  <p>I'm avoiding <code>LiveData</code> in the repository layer in favor of <code>Flow</code>. Yet, I need to set, observe and collect the value for immediate consumption. The later is useful for authentication purpose in a OkHttp3 <code>Interceptor</code>.</p>