wanandroid
wanandroid copied to clipboard
首页,体系,公众号,导航,项目无数据
E/flutter: [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: DioError [DioErrorType.DEFAULT]: HandshakeException: Handshake error in client (OS Error: CERTIFICATE_VERIFY_FAILED: certificate is not yet valid(handshake.cc:352)) null
1、更新pubspec.yaml dio为 dio: ^2.1.0 2、修改DioManager类为
class DioManager { Dio _dio;
DioManager._internal() { _dio = new Dio(); (_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate = (client) { client.badCertificateCallback = (X509Certificate cert, String host, int port) { return true; }; }; }
static DioManager singleton = DioManager._internal();
factory DioManager() => singleton;
get dio { return _dio; } }