delayed_proxy_http_client 1.0.0

SDKdartflutter
Platformandroidioswindowslinuxmacos

HttpClient implementation which can resolve proxy server asynchronously.

Dart CI pub package

This lightweight package provides implementation of HttpClient extended with one property named findProxyAsync. It is designed to be used with packages like system_proxy_resolver which can resolve proxy server dynamically based on PAC script configured in OS settings.

Usage

To use this plugin, add delayed_proxy_http_client as a dependency in your pubspec.yaml file.

Example

Here is small example that show you how to use the API.

final client = DelayedProxyHttpClient();
client.findProxyAsync = (url) async {
  await Future.delayed(const Duration(seconds: 3));
  return url.host == "pub.dev" ? "PROXY localhost:3128" : "DIRECT";
};

final request = await client.getUrl(Uri.parse("https://pub.dev"));
final response = await request.close();
await stdout.addStream(response);