title: How do I asyncronously build an array of data?
body: <pre><code>  List responseJson;
    List eventDetails = [];
  
       Future&lt;String&gt; fetchPost() async {
        final response = await http.get(
          "https..",
          headers: {
            HttpHeaders.AUTHORIZATION:
            "Bearer ..."
          });
  
             for(var i = 0; i&lt; (responseJson?.length ?? 0);i++) {
  
             final eventDetailsResponse = await http.get(
             "https:.." + responseJson[i]["id"].toString(),
              headers: {
              HttpHeaders.AUTHORIZATION:
              "Bearer .."
            });
  
        eventDetails.add(json.decode(eventDetailsResponse.body));
      }
  
  this.setState(() {
    responseJson = json.decode(response.body);
    print(eventDetails);
    print(responseJson);
  
  });
  </code></pre>
  
  <p>Hi there! I have an array defined, I filled the array in with elements, each element is the result of an API call, and then I use the function this.setState to trigger the list view to update, on the first run eventDetails is empty, however on the second run it gets filled in with data, how can I make it await?
  Thank you in advance.</p>