title: Wait until function returns true
body: <p>Does Dart have a method to wait for a function to return a true/false then call the next function after it?</p>
  <p>I have seen similar questions here, but I cannot seem to get them to work in a way to achieve my goal.
  Some of the answers use explicit delayed time (.e.g wait 3 seconds). But this doesn't work for my method.</p>
  <p>E.g.</p>
  <pre><code>print('START');
  await fetchResults(); 
  print('COMPLETE'); // This is not called until the fetchResults returns true/false
  </code></pre>
  <p>NOTE: I have tried something like:</p>
  <pre><code>Future&lt;bool&gt; fetchResults() { 
     await Future.doWhile(() =&gt; return true);
  }
  </code></pre>
  <p>But this puts my function in infinite loop.</p>