title: Flutter Post API call
body: <p>I'm working on flutter project, in which I'm calling an POST API. Its response is like</p>
  <pre><code>{
      &quot;_id&quot;: &quot;5f61a39b8b7cf93550898b63&quot;,
      &quot;buildname&quot;: &quot;ANT PC DORYLUS RZ320G&quot;,
      &quot;processor&quot;: &quot;AMD Ryzen 3 3200G (4Core, 4Threads, Upto 4.0 Ghz)&quot;,
      &quot;motherboard&quot;: &quot;MSI B450M PRO m2 Max&quot;,
      &quot;ram&quot;: &quot;8GB ADATA XPG Gammix D30 DDR4 3000MHz&quot;,
      &quot;graphiccard&quot;: &quot;Radeon Vega Graphics&quot;,
      &quot;ssd&quot;: &quot;120GB ADATA/Crucial SATA SSD&quot;,
      &quot;hdd&quot;: &quot;1 TB WD Blue SATA HDD 7200 RPM&quot;,
      &quot;psu&quot;: &quot;Antec VP450P IN&quot;,
      &quot;cpucooler&quot;: &quot;AMD STOCK COOLER&quot;,
      &quot;os&quot;: &quot;30 Days Microsoft Windows 10 Home 64-Bit Trial&quot;,
      &quot;cpucase&quot;: &quot;Antec NX200&quot;,
      &quot;price&quot;: &quot;28437.00&quot;,
      &quot;createdAt&quot;: &quot;2020-09-16T05:33:15.383Z&quot;,
      &quot;__v&quot;: 0
  }
  </code></pre>
  <p>I wrote this following code but it showing me an error type <code>'_InternalLinkedHashMap&lt;String, dynamic&gt;' is not a subtype of type 'PreBuildResponse'</code></p>
  <p>Code:</p>
  <pre><code>  Future&lt;List&lt;PreBuildResponse&gt;&gt; _fetchProduct() async {
       final url = 'http://10.0.2.2:3000/prebuild/product';
       final response = await http.post(
          url,
          body: {
             'id' : &quot;$productId&quot;
          }
       );
       if (response.statusCode == 200) {
          List jsonResponse = json.decode(response.body);
          return jsonResponse
             .map((list) =&gt; new PreBuildResponse.fromJson(list))
             .toList();
       } else {
          throw Exception('Failed to load data from API');
       }
   }
  
  
    @override
    Widget build(BuildContext context) {
      return Container(
          color: Colors.white,
          child: SingleChildScrollView(
          child: FutureBuilder(
            future: _fetchProduct(),
            builder: (context, snapshot) {
              if (snapshot.hasData) {
                PreBuildResponse data = snapshot.data;
                return Text(data.buildname);
              } else if (snapshot.hasError) {
                return Text(&quot;${snapshot.error}&quot;);
              }
              return CircularProgressIndicator();
            },
          ),
        )
      );
    }
  }
  </code></pre>
  <p>And find the model code here <a href="https://gist.github.com/vaandhare/3aa46c71369f012514cfafe4911cd11c" rel="nofollow noreferrer">https://gist.github.com/vaandhare/3aa46c71369f012514cfafe4911cd11c</a></p>