flutter dio设置代理

(_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
          (client) {
            client.findProxy = (url) {
              ///设置代理 电脑ip地址
              return "PROXY 192.168.31.102:8888";

              ///不设置代理
//          return 'DIRECT';
            };

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

mark 一下,方便以后使用

你可能感兴趣的:(Flutter,Dart)