如何在flutter中创建嵌套的json对象

时间:2019-03-13 13:19:06

标签: json flutter

//我需要将嵌套的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});

0 个答案:

没有答案