title: How to emit Flow value from different function? Kotlin Coroutines
body: <p>I have a flow :</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>val myflow = kotlinx.coroutines.flow.flow&lt;Message&gt;{}
  </code></pre>
  
  <p>and want to emit values with function:</p>
  
  <pre class="lang-kotlin prettyprint-override"><code>override suspend fun sendMessage(chat: Chat, message: Message) {
      myflow.emit(message)
  }
  </code></pre>
  
  <p>But compiler does not allow me to do this, is there any workarounds to solve this problem?</p>