title: How to use nested FutureBuilders and make sure one future is called after another?
body: <p>To avoid my <code>FutureBuilder</code> being called again and again (see <a href="https://medium.com/saugo360/flutter-my-futurebuilder-keeps-firing-6e774830bc2" rel="noreferrer">this</a>), I have the habbit of calling my futures in <code>initState</code> and it has always worked fine until I had to use nested ones.</p>
  
  <p>Basically I want the second future to get called only after <code>connectionState</code> of 1st one becomes <code>done</code>. Any help?</p>
  
  <p>Here is my code to explain further-</p>
  
  <pre><code>FutureBuilder(
    future: _future1,
    builder: (BuildContext context, AsyncSnapshot snapshot) {
      return snapshot.connectionState != ConnectionState.done
          ? CircularProgressIndicator()
          : snapshot.data != 200
              ? SomeWidget()
              : FutureBuilder(
                  future: _future2,
                  builder: (BuildContext context, AsyncSnapshot snapshot) {
                    return snapshot?.connectionState == ConnectionState.done
                        ? Text('')
                        : CircularProgressIndicator();
                  });
    },
  );
  </code></pre>
  
  <p>So basically, I don't want <code>_future2</code> to get called at all if the data received from <code>_future1</code> isn't 200. In other words, I want to decide whether <code>_future2</code>should be called or not on basis of result of <code>_future1</code>.</p>