Dio代码设置代理

Dio库代码设置代理抓取数据包:

Dio _dio = new Dio();
(_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
          (client) {
        client.findProxy = (url) {
          ///设置代理 电脑ip地址
		//return "PROXY 10.20.11.235:8888";
          ///不设置代理
          return 'DIRECT';
           };

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

你可能感兴趣的:(技术专区)