【发布时间】:2018-12-07 01:55:54
【问题描述】:
我是 Flutter 开发的新手。我的问题是,当我尝试将图像上传到服务器时,出现以下错误:
NoSuchMethodError: The getter 'body' was called on null.
Receiver: null
Tried calling: body
这是我的代码:
var response;
var booking_info_url='http://18.207.188.4/ruralpost/api/api.php?action=booking';
http.post(booking_info_url,body: {"userid":"3","weight":"20","quantity":"1","bimage":base64UrlEncode(await _image.readAsBytesSync())}).then(response);
{
print("Response body: ${response.body}");
}
【问题讨论】:
-
您考虑过我对the definite article 的建议吗?它会帮助你写出更精确的问题。
-
参考This的回答了解如何在flutter中上传图片
-
已经尝试过@ShyjuMadathil