我正在通过rest API上传图像,我已成功上传图像。发送帖子请求后,我想取回数据。上传图片时,我还需要显示进度指示器。我如何获取值,我尝试使用Future Builder来获取它,但没有任何值。----------------------------- --------------------------
function alter_image_attributes($attr) {
$attr['data-src'] = 'compressed_image_url';
return $attr;
}
add_filter( 'wp_get_attachment_image_attributes', 'alter_image_attributes');
答案 0 :(得分:8)
在MultipartRequest之后接收数据,而不是此
// send
var response = await request.send();
print(response.statusCode);
// listen for response
response.stream.transform(utf8.decoder).listen((value) {
print(value);
});
尝试一下:
http.Response response = await http.Response.fromStream(await request.send());
print("Result: ${response.statusCode}");
return response.body;