title: Wait for stream inside a Future: Flutter
body: <p>I want to check if the Firebase DB is connected or not, so I have to use a Future to return a boolean</p>
  
  <p>Have a check at my code..</p>
  
  <pre><code>@override
  Future&lt;bool&gt; isAvailable() async {
   bool ret = false;
   await firebaseInstance.reference().child('.info/connected').onValue.listen((event) {
    ret =  event.snapshot.value;
  });
  
  return ret;
  }
  </code></pre>
  
  <p>the firebaseInstace.reference is a StreamSubscription type and does not wait for the future to return me a result.</p>
  
  <p>please help.</p>