title: Display the result of the POST request in flutter
body: <p>I am trying to create a page that displays the data received after hitting an API,</p>
  
  <p>my response JSON looks like this </p>
  
  <pre><code>{
    “Total_count”: 100,
    "queryColumns": [
      {
        “title”:”done”,
        “count”:120,
        “percentage” :48 
      },
      {
        “title”:”partially_done”,
        “count”:30,
        “percentage” : 12
      },
      {
        “title”:”Not Done”,
        “count”:100,
        “percentage” : 40
      }
    ]
  }
  </code></pre>
  
  <p>Everytime I hit the API I might get a different result,
  I am trying to display this data in the app.</p>
  
  <p>My flutter code looks like below,</p>
  
  <p>and  I am calling another widgets i.e buildRadialProgressBar inside the build() which receiving the arguements it generates the circular view .</p>
  
  <p>in below for buildRadialProgressBar i am passing data directly like (GIVING THE DUMMY DATA)
  \</p>
  
  <pre><code>buildRadialProgressBar(
    progressPercent: 0.48,
    color: Colors.green,
    count: 120,
    title: 'done',
  )
  </code></pre>
  
  <p>build widget looks like this,</p>
  
  <pre class="lang-dart prettyprint-override"><code>Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: LimitedBox(
        maxHeight: MediaQuery.of(context).size.height / 1.30,
        child: Column(
          mainAxisSize: MainAxisSize.max,
          mainAxisAlignment: MainAxisAlignment.center,
          children: &lt;Widget&gt;[
            Row(
              children: &lt;Widget&gt;[
                buildSubscriberTile(context),
                buildRadialProgressBar(
                  context: context,
                  progressPercent: 0.48,
                  color: Colors.green,
                  count: 120,
                  title: 'done',
                ),
              ],
            ),
            Row(
              children: &lt;Widget&gt;[
                buildRadialProgressBar(
                  context: context,
                  progressPercent: 0.12,
                  color: Colors.red,
                  count: 30,
                  title: 'Not done',
                ),
                buildRadialProgressBar(
                  context: context,
                  progressPercent: 0.40,
                  color: Colors.purple,
                  count: 100,
                  title: 'partially done',
                )
              ],
            ),
          ],
        ),
      ),
    );
  }
  </code></pre>
  
  <p>what i am trying to do is rather than giving dummy values , I want it to take from the result of the POST request. and display, </p>
  
  <p>for the dummy data its everything is working fine(display part) but I dont know how to initialize those parameters inside the buildRadialProgressBar with the result of the json output.</p>
  
  <p>remaining code as follows</p>
  
  <pre class="lang-dart prettyprint-override"><code>void initState() {
    super.initState();
    reportList = getReport(); //Iam callling the API
  }
  
  getReport() async {
    http.Response response =
      await http.get(PostURL, headers: {"token": "$token"});
    switch (response.statusCode) {
      case 200:
        String reportList = response.body;
        var collection = json.decode(reportList);
        return collection;
        break;
      case 403:
      case 401:
        return null;
      default:
        return 1;
    }
  }
  </code></pre>