flutter - 未处理的异常:键入“列表”' 不是类型转换中类型 'String' 的子类型
问题描述
**我尝试使用 List 的正文内容发送订单 ** 但是当我发送该正文时,我无法发送颤振运行错误,List is not type in String 我想将 int 列表发送到服务器,不是字符串
void _sendOrder(
String Token,
var name,
var email,
var phone,
var phone2,
var city,
var area,
List<int> idProduct,
List<int> qtys,
List<double> unti_price,
var imageBase64) async {
var body = {
'serial': '0',
'customer_email': email,
'customer_phone': phone,
'customer_first_name': name,
'customer_last_name': "UGOOD",
'billing_first_name': name,
'billing_last_name': "UGOOD" ,
'billing_address_1': "Sudan",
'billing_address_2': "Sudan",
'billing_city': phone2,
'billing_state': area ,
'billing_zip': "0000",
'billing_country': phone2,
'shipping_first_name': name,
'shipping_last_name': "UGOOD" ,
'shipping_country': city,
'shipping_address_1': "Sudan",
'shipping_address_2': "Sudan",
'shipping_city': city ,
'shipping_state': area,
'shipping_zip': "0000",
'products[]' : idProduct,
'qty[]' : qty,
'unit_price[]' :unti_price,
'prescription': imageBase64.toString(),
};
print([body]);
final String UrlProducts = "https://";
http.Response Response = await http.post(Uri.parse(UrlProducts),
headers: {HttpHeaders.authorizationHeader: Token},
body:body);
if(Response.statusCode == 200){
print(Response.body);
}else{
print(Response.body);
}
解决方案
我联系了后端的开发人员,他将接收器更改为接收字符串和 int
推荐阅读
- bash - Ubuntu 上的 incron - incrontab 调用的 bash 脚本 - 美元括号 $(command) 命令替换失败
- ssl - Nginx 上游到 https 主机 - ssl3_get_record:错误的版本号
- mongodb - MongoDB 集合结构
- python - 当它靠近另一只海龟时停止移动的 Python 海龟
- reactjs - react redux 解析错误:意外字符''
- javascript - 如何动态更改视频源以便播放不同的视频
- python - Reddit to Twitter python bot error (python: praw & tweepy used)
- javascript - 如何使用 this.val() 从列表中的输入中提取值?
- java - 如何仅对其中一个字段与 Lucene 7.5.0 中的特定值匹配的文档执行查询搜索?
- azure - 获取 azure powershell 上其标签以(或包含)特定字符串开头的所有资源 - Azure Powershell