system_proxy_resolver
A Dart Package to read proxy settings from the OS. With this plugin you can resolve proxy
setting for specific URL via PAC scripts.
system_proxy_resolver can be used in pure Dart as well!
Features
xFFI implementation so that package can be used from any isolate without additional configurationxSupport for both pure Dart and Flutter projectsxiOS&macOS support via CFNetworkxWindows support via WinHTTPAndroid support via IProxyServiceLinux support via libproxy
Usage
final resolver = SystemProxyResolver();
print(resolver.getSystemProxySettings());
print(await resolver.getProxyForUrl(Uri.parse("https://pub.dev")));
Usage with delayed_proxy_http_client
final client = DelayedProxyHttpClient();
client.findProxyAsync = (url) async {
try {
final proxies = await proxyResolver.getProxyForUrl(url);
return proxies.map((e) => e.direct ? "DIRECT" : "PROXY ${e.host}:${e.port}").join("; ");
} on Object catch (e) {
return "DIRECT";
}
};
...