[英]I/flutter : FormatException: Unexpected end of input (at character 1)
I/flutter (28194): error is: FormatException: Unexpected end of input (at character 1) I/flutter (28194): 错误是: FormatException: Unexpected end of input (at character 1)
Future<void> addRateOrder(String comment, int rate, String orderId) async{
Map<String, dynamic> rateOrderData = Map();
rateOrderData['Comment'] = comment;
rateOrderData['Rate'] = rate.toString();
try{
String url = Urls.buildRateOrder(orderId);
final response = await retry(
()=>http.post(url,
body: rateOrderData)
.timeout(Duration(seconds: 5)),
retryIf: (e)=> e is SocketException || e is TimeoutException
);
final responseData =json.decode(response.body);
print(responseData);
}catch(error){
print('error is: $error');
throw error;
}
}
sometimes it happens due to sending same request to same Api twice in your code有时它是由于在您的代码中两次向相同的 Api 发送相同的请求而发生的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.