title: How to wait for a regular (non async) code (function) in flutter?
body: <p>I want to search for a word in a big text file that is local (not calling any HTTP or API).
  I'm using it with FutureBuilder because <strong>only</strong> the opening of the text file is async (the rest isn't)
  but the opening itself is very fast. 
  I want to render CircularProgressIndicator, while searching, but it seems that the moment it finishes <strong><em>opening</em></strong> the file, the  CircularProgressIndicator <strong>stops</strong>, and I have a blank screen for the long searching time. </p>
  
  <p>What can I do to present a loading screen also while doing the <strong>regular</strong> for loop? </p>
  
  <p>What I have is something like this pseudocode:</p>
  
  <pre><code>Future&lt;Array&gt; searchData() async{
      results = [];
      someBigTextFile= await getTextFile();
      for(row in someBigTextFile){ // this loop takes a lot of time
          if(row contains this.query) results.add(row);
      }
      return results;
  }
  
  Widget buildResults(BuildContext context) {
    return FutureBuilder(
      future: searchData(),
      builder: (BuildContext context, AsyncSnapshot&lt;Array&gt; snapshot){
          if (snapshot.connectionState != ConnectionState.done) {
             print("not done yet");
             return CircularProgressIndicator();
          } else {
             return snapshot.data;
          }
    }
  }
  </code></pre>