setProxy function

dynamic setProxy(
  1. Dio dio, {
  2. required String proxyUrl,
})

Implementation

setProxy(adio.Dio dio, {required String proxyUrl}) {
  (dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
      (client) {
    client.findProxy = (uri) {
      return "PROXY $proxyUrl";
    };

    ///忽略证书
    client.badCertificateCallback =
        (X509Certificate cert, String host, int port) => true;
    return null;
  };
}