【发布时间】:2021-06-22 10:11:08
【问题描述】:
你好,我正在尝试使用 JSON 和文件一起进行发布请求,应该如何
static Future postApost(String posttitle,image,String value,token) async {
var data = {'posttitle': posttitle, 'post': image.readAsBytes(),'category': value};
await http.post("https://lighte.org/public/api/newpost",headers: {
'Authorization': 'bearer $token',
},body: data).catchError((error) {
print(error.toString());
});
}
【问题讨论】: