flutter - 从 flutter app 发布数据时出现此错误。未处理的异常:FormatException:无效的 radix-10 数字(在字符 1)
问题描述
注意:我使用真实设备进行应用预览,笔记本电脑和设备共享相同的 wifi。我已将 localhost 更改为 Ipv4 地址。
这是代码片段:
`var response=await http.post(Uri.https('http://***.***.***.**:10000','/postAd'),
headers: <String, String>{ 'Content-Type': 'application/json; charset=UTF-8', },
body:jsonEncode(<String,String>{
"category":currentSelectedValue,
"title":_serviceTitle.text,
"description":_description.text,
"phone":_phone.text,
"image":base64Image,
}
)
);`
我已经在服务器端处理了“/postAd”路由,并用 Postman 对其进行了测试[它工作正常]。
/flutter (31503): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: FormatException:
Invalid radix-10 number (at character 1)
E/flutter (31503): //***.***.***.**:10000
E/flutter (31503): ^
E/flutter (31503):
E/flutter (31503): #0 int._throwFormatException (dart:core-patch/integers_patch.dart:131:5)
E/flutter (31503): #1 int._parseRadix (dart:core-patch/integers_patch.dart:157:16)
解决方案
推荐阅读
- python - 用不连续的不同顺序为 AR 和 MA 拟合 ARIMA 模型,即使用 python 的 ARMA 模型
- javascript - 如何将我的所有内容集中在 html 中?
- linux - Cronjob 卡住而不退出
- xamarin - Xamarin 将选取器绑定到标签绑定
- python - 使用烧瓶 Python 将文件上传到 Amazon S3 存储桶
- javascript - 如何使用css在底部移动按钮?
- r - 在R中组合多列?
- python - 如何在循环中动态生成气流任务并并行运行?
- rust - 如何取消引用元组的引用
- php - 如何将创建用户的 id 添加到 user_id 列