我在用flutter发布json数组时遇到一些问题。
[当我使用json与邮递员打api时,它可以工作。屏幕截图邮递员:
因为我知道身体上只接受Map << [String,String] >> CMIIW所以我把身体变成这样
List<Map<String,String>> products = [
{
"product_id": "1",
"buy_quantity": "1",
"product_price": "1000",
"is_voucher": "0",
},
{
"product_id": "2",
"buy_quantity": "2",
"product_price": "2000",
"is_voucher": "0",
},
];
final String jsonProduct = json.encode(products);// here im trying to
Map<String,String> _body = {
"buyer_id": '',
"buyer_firstname": postCart.buyerFirstname,
"phone_number": postCart.phoneNumber,
"transaction_total_price": postCart.transactionTotalPrice.toString(),
"voucher_id": 0.toString(),
"voucher_code": 0.toString(),
"payment_id": postCart.paymentId.toString(),
"payment_name": postCart.paymentName,
"products" : jsonProduct
};
但是我仍然有错误,
谢谢!
我在用flutter发布json数组时遇到一些问题。当我使用json与邮递员打api时,它可以工作。屏幕快照邮递员:因为我知道身体上只接受Map
CMIIW,所以我打开...