qm_flutter_proxy 1.0.1 copy "qm_flutter_proxy: ^1.0.1" to clipboard
qm_flutter_proxy: ^1.0.1 copied to clipboard

http proxy plugin,get and set http proxy automatically.This package help you to use proxy tools

qm_flutter_proxy #

This plugin comes from the plugin http_proxy, only the Android part has been upgraded. It can automatically get the proxy settings of mobile devices and set the proxy for dio.


How to use #

1.Dio used

HttpProxy httpProxy = await HttpProxy.createHttpProxy();
    var proxyHost = httpProxy.host;
    var proxyPort = httpProxy.port;
    if (proxyHost == null) return;
    dio.httpClientAdapter = IOHttpClientAdapter(
      createHttpClient: () {
        final client = HttpClient();
        client.findProxy = (uri) {
          return "PROXY $proxyHost:$proxyPort";
        };
        client.badCertificateCallback =
            (X509Certificate cert, String host, int port) {
          return true;
        };
        return client;
      },
    );

2.Dio not used

You should initialize before runapp().

void main() async {
    WidgetsFlutterBinding.ensureInitialized();
    HttpProxy httpProxy = await HttpProxy.createHttpProxy();
    HttpOverrides.global=httpProxy;
    runApp(MyApp());
  }
1
likes
150
points
202
downloads

Publisher

unverified uploader

Weekly Downloads

http proxy plugin,get and set http proxy automatically.This package help you to use proxy tools

Homepage
Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on qm_flutter_proxy