title: How to convert cURL -X -u, -H, -d to http post in Flutter
body: <p>I am facing problem while converting cURL to flutter http post.</p>
  <p><strong>Below is the cURL code available</strong></p>
  <pre><code>curl  -X POST url
  -u &lt;YOUR_KEY_ID&gt;:&lt;YOUR_SECRET&gt;
  -H 'content-type:application/json'
  -d '{    &quot;amount&quot;: 50000,    &quot;currency&quot;: &quot;INR&quot;,    &quot;receipt&quot;: &quot;rcptid_11&quot;}'
  </code></pre>
  <p><strong>Below is the code that I have rewritten in flutter with the help of <a href="https://flutter.dev/docs/cookbook/networking/send-data" rel="nofollow noreferrer">flutter documentaion</a>.</strong></p>
  <pre><code>  Future&lt;Album&gt; createAlbum() async{
      final response = await http.post(
        Uri.parse('url'),
        headers: {
          HttpHeaders.authorizationHeader: '&lt;$_key&gt;:&lt;$_secretKey&gt;',
          HttpHeaders.contentTypeHeader: 'application/json',
        },
        body: jsonEncode(&lt;String, String&gt;{
          &quot;amount&quot;: (amount*100).toString(),
          &quot;currency&quot;: &quot;INR&quot;,
          &quot;receipt&quot;: date,
        }),
      );
  
      if (response.statusCode == 201) {
        print('Success');
        return Album.fromJson(jsonDecode(response.body));
      } else {
        throw Exception('Failed to create album.');
      }
    }
  </code></pre>
  <p>All the parameters are defined in the class and used in createAlbum method. http post fails to send data.</p>
  <p>Thanks!</p>