通过dio.post时遇到了400错误,直接到异常处理区域了,可以通过catch进行拦截

try {

  // 发送请求
  Response response = await dio.post(ossUrl, data: data);
  print(response.statusCode);
  print(response.statusMessage);
  return 'success';
} on DioError catch (e) {
  print(e.response!.statusCode);
  print(e.response!.statusMessage);
  throw(e);
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2021-11-20
  • 2021-12-27
  • 2021-06-02
  • 2022-12-23
  • 2021-08-27
猜你喜欢
  • 2021-07-13
  • 2021-05-31
  • 2021-12-12
  • 2021-08-01
  • 2021-12-24
  • 2021-06-21
  • 2022-12-23
相关资源
相似解决方案