简体   繁体   English

I/flutter:FormatException:输入意外结束(在字符 1 处)

[英]I/flutter : FormatException: Unexpected end of input (at character 1)

  • I am facing an error when i try to post an OrderRate and comment to the server, i get the below error.当我尝试向服务器发布 OrderRate 和评论时遇到错误,我收到以下错误。

I/flutter (28194): error is: FormatException: Unexpected end of input (at character 1) I/flutter (28194): 错误是: FormatException: Unexpected end of input (at character 1)

  • also that is the code which causes the issue:这也是导致问题的代码:

 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.

相关问题 FormatException:输入意外结束(在字符 2 处)^ 在 flutter - FormatException: Unexpected end of input (at character 2) ^ in flutter FormatException: 意外的输入结束(在字符 1 处) - FormatException: Unexpected end of input (at character 1) FormatException:输入意外结束(在字符 1 处)^ - FormatException: Unexpected end of input (at character 1) ^ Flutter OperationException(linkException: ResponseFormatException(originalException: FormatException: 输入意外结束(在字符 1 处) - Flutter OperationException(linkException: ResponseFormatException(originalException: FormatException: Unexpected end of input (at character 1) FormatException:OSM map 的输入意外结束(在字符 1 处) - FormatException: Unexpected end of input (at character 1) with OSM map 未处理的异常:FormatException:意外的输入结束(在字符 1) - Unhandled Exception: FormatException: Unexpected end of input (at character 1) 未处理的异常:FormatException:输入意外结束(在字符 2 处) - Unhandled Exception: FormatException: Unexpected end of input (at character 2) ObjectBox 失败:“FormatException:输入意外结束(在字符 1 处)” - ObjectBox Failure: "FormatException: Unexpected end of input (at character 1)" 我需要解决 FormatException: Unexpected character Flutter? - I need to solve FormatException: Unexpected character Flutter? 未处理的异常:FormatException:flutter(在 shared_preferences 中)的输入意外结束(在字符 1) - Unhandled Exception: FormatException: Unexpected end of input (at character 1) in flutter (in shared_preferences)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM