findProxyFromEnvironment method
Resolves the proxy server to be used for HTTP connections.
When this override is installed, this function overrides the behavior of
HttpClient.findProxyFromEnvironment
.
Implementation
@override
String findProxyFromEnvironment(Uri url, Map<String, String>? environment) {
if (host == null) {
return super.findProxyFromEnvironment(url, environment);
}
if (environment == null) {
environment = {};
}
if (port != null) {
environment['http_proxy'] = '$host:$port';
environment['https_proxy'] = '$host:$port';
} else {
environment['http_proxy'] = '$host:8888';
environment['https_proxy'] = '$host:8888';
}
return super.findProxyFromEnvironment(url, environment);
}