我想将图像作为帖子发送到我的烧瓶api。当我发送为
String base64Image = base64Encode(image.readAsBytesSync());
String fileName = image.path.split("/").last;
try {
http.Response response = await http.post(baseUrl,body: base64Image,);
//final response = zx;
if (response.statusCode != 200) {
return null;
}
final Map<String, dynamic> responseData = json.decode(response.body);
_resetState();
return responseData;
} catch (e) {
print(e);
return null;
}
它仅发送一次响应,如果我关闭我的应用程序并重新打开,则Flutter仅向我的api发送空响应。
之后,我的烧瓶api又收到了[47 57 106 ... 47 47 90]一件事r = request
nparr = np.fromstring(r.data, np.uint8)
但是当我想使用它解码时
frame = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
然后api不打印任何内容。