//我需要将嵌套的JSON对象发送到API。这是我的API端点代码;
{
"type":"PIZA",
"request_method":"Test",
"delivery": {
"category": 1
},
//源地址详细信息
"source":{
"name":"A road",
"latitude":"40.6971494",
"longitude":"-74.2598678"
},
//目的地址详细信息
"destination":{
"name":"B road",
"latitude":"40.8516388",
"longitude":"-73.9109741"
},
//包裹详细信息
"package":{
"description":"Test sample"
}
}
//发布异步请求
requestAsync(String httpURL, String sourceName, String destinationName) async {
final response = await http
.post(httpURL, body: {"source": source, "destination": destinationName});