title: Dart HTTP POST with Map<String, dynamic> as body
body: <p>The Dart <a href="https://pub.dartlang.org/packages/http" rel="nofollow noreferrer">http package</a>'s <code>post</code> method only accepts a <code>String</code>, a <code>List&lt;int&gt;</code> or a <code>Map&lt;String, String&gt;</code> as the request <strong>body</strong>.
  I need to send and object of this class as body with Content-Type header application/json:</p>
  
  <pre><code>class CreateListingRequest {
    String title;
    List&lt;ListingImage&gt; images;
    List&lt;int&gt; categoryIds;
  }
  </code></pre>
  
  <p>where <code>ListingImage</code> is</p>
  
  <pre><code>class ListingImage {
    String url;
    int position;
  }
  </code></pre>
  
  <p>In Postman I would build the body as raw json with Content-Type header <code>application/json</code> like this:</p>
  
  <pre><code>{
    "title": "Testing transaction force fail",
    "listing_images": [
      {
        "url": "https://picsum.photos/500/500/?image=336",
        "position": 0
      },
      {
        "url": "https://picsum.photos/500/500/?image=68",
        "position": 1
      },
      {
        "url": "https://picsum.photos/500/500/?image=175",
        "position": 2
      }
    ],
    "category_ids": [19, 26]
  }
  </code></pre>
  
  <p>It seems to me that if I could send a <code>Map&lt;String, dynamic&gt;</code> that would solve the problem but I can only send <code>Map&lt;String, String&gt;</code>.</p>
  
  <p>Help please.</p>