title: How do I wait until query is completed in kotlin?
body: <p>I'm trying to return a boolean value if the query is successful but kotlin is asynchronous.  </p>
  
  <pre><code>private fun checkDidAdd(geoPoint: GeoPoint, fullAddress: String):Boolean {
          var added = false
          scope.launch {
              val docRef = db.collection("listings")
                  .get()
                  .addOnSuccessListener { result -&gt;
                      for (document in result) {
                          //todo
                          }
                              added = true
                      }
  
  
  
                  }.addOnFailureListener { exception -&gt;
                      Log.d("TAG", "Error getting documents: ", exception)
                  }
              println("done!!")
          }
  
          return added
      }
  </code></pre>