从 flutter app 发布数据时出现此错误未处理的异常:FormatException:无效的基数 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)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)