findProxyAsync property

void findProxyAsync=(FutureOr<String> f(Uri url)?)

Sets the function used to asynchronously resolve the proxy server to be used for opening a HTTP connection to the specified url. If this function is not set, direct connections will always be used.

The string returned by f must be in the format used by browser PAC (proxy auto-config) scripts. That is either


for using a direct connection or

"PROXY host:port"

for using the proxy server host on port port.

A configuration can contain several configuration elements separated by semicolons, e.g.

"PROXY host:port; PROXY host2:port2; DIRECT"

The static function findProxyFromEnvironment on HttpClient class can be used to implement proxy server resolving based on environment variables.

This will override the value set for findProxy.


set findProxyAsync(FutureOr<String> Function(Uri url)? f) => _findProxy = f;