title: Why CallbackFlow is running on main thread
body: <p>I am using callback flow in my code to retrieve data from Firebase Database. Here is my code</p>
  <pre><code> @ExperimentalCoroutinesApi
    suspend fun getUserOrder() = callbackFlow&lt;UserOrder&gt;{
              println(&quot;Current Thread name is ${Thread.currentThread().name}&quot;)
              databaseReference.child(&quot;Order&quot;).addValueEventListener(object : ValueEventListener{
                  override fun onCancelled(error: DatabaseError) {
                      Log.d(&quot;database error &quot;,error.message)
                      channel.close(error.toException())
                  }
  
                  override fun onDataChange(snapshot: DataSnapshot) {
                      if (snapshot.exists()){
                          snapshot.children.forEach { data -&gt;
                              data.children.forEach {newData-&gt;
                                  newData.children.forEach { childData-&gt;
                                      val userOrder = UserOrder(
                                          childData.key!!,
                                          childData.child(&quot;item_name&quot;).value as String,
                                          childData.child(&quot;item_price&quot;).value as String,
                                          childData.child(&quot;item_quantity&quot;).value as String,
                                          childData.child(&quot;item_weight&quot;).value as String
                                      )
                                      offer(userOrder)
                                  }
                              }
                          }
                          channel.close()
                      }
                  }
              })
          awaitClose()
      } 
  
  //Activity class code
    viewModel.viewModelScope.launch {
          val time = measureTimeMillis {
              viewModel.getOrder().collect {
                  println(&quot;Item id is ${it.item_id}&quot;)
              }
          }
          println(&quot;Total time taken is $time&quot;)
      }
  </code></pre>
  <p>Data is retrieving but it is running on main thread. I wanna run it on background thread. How is it possible?. Tell me anybody</p>