title: How to post line_items in json file through woocommerce rest api?
body: <p>I've successfully used rest api of woocommerce in my flutter app but I'm stuck at one point which is adding line_items in json file through woocommerce rest API.</p>
  <pre><code>List&lt;CartPdt&gt;linecartitems=[];
  linecartitems.map((i)=&gt;{
    'product_id':int.parse(i.id),
    'quantity':i.quantity
  }).toList();
  
  var lc=json.encode(linecartitems);
  
  var createOrderUrl = await http.post(
      'url',
      body: json.encode({
        'billing': {
          'first_name': fname,
          'last_name': lname,
          'email': email,
          'address': address,
          'city': city,
          'phone': phone
        },
        'line_items':lc,
      }),
      headers: {&quot;Content-Type&quot;: &quot;application/json&quot;},
    );
  </code></pre>