如何使用flutter中的表单数据在http或dio请求中发送数组

问题描述 投票:0回答:1

我正在将表单数据发送到api。这是以下模式的图像。我将如何处理image

http flutter dart dio
1个回答
0
投票

与发送任何其他类型的表单数据应该没有什么不同。将键值对添加到Map,并将其作为bodyhttp.post()参数传递。

例如:

var body = <String, String>{
  'vt_dates[0]': '2019-10-12',
  'vt_dates[1]': '2019-10-12',
  'vt_from[0]': '10:00',
  // etc
};
var response = await http.post(url, body: body);
© www.soinside.com 2019 - 2024. All rights reserved.