![](/img/trans.png)
[英]How to cancel ongoing file upload sent with http.MultipartRequest() in Flutter?
[英]How can I convert the response of a http.MultipartRequest POST method in a map<String, dynamic> in Flutter?
我正在使用以下方法:
var request = http.MultipartRequest('POST', Uri.parse(urlAdicionaItem));
request.fields["comanda"] = numeroComanda.toString();
request.fields["produto"] = idProduto.toString();
request.fields["quantidade"] = quantidade.toString();
var res = await request.send();
但我不知道如何將res.stream 中的response.body 轉換為使用常規http.post 方法處理數據。
在您的代碼示例中res
將是一個StreamedResponse ,它可以變成這樣的String
:
final responseString = await response.stream.bytesToString();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.