proxy property
String?
proxy
Implementation
static String? get proxy => _proxy;
Implementation
static set proxy(String? proxy) {
if (proxy?.isEmpty ?? true) return;
_proxy = proxy;
(dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
(HttpClient client) {
client.findProxy = (uri) {
///这里的 192.168.0.102:8888就是我们的代理服务地址
final str = "PROXY $proxy";
return str;
};
client.badCertificateCallback = (
X509Certificate cert,
String host,
int port,
) {
return true;
};
};
}