dio添加代理

    (dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
        (client) {
      // config the http client
      client.findProxy = (uri) {
        CommonUtils.log('fcs-myproxy-begin:${uri is Uri} uri:${uri.toString()}');
        return "PROXY 192.168.10.47:8888";//如果设置代理(localhost,127.0.0.1这样的是不行的。必须是电脑的ip)
//        return 'DIRECT';// 如果不设置代理
      };
      client.badCertificateCallback =
          (X509Certificate cert, String host, int port) => true;//忽略证书
    };

你可能感兴趣的:(dio添加代理)