osproxysetting 0.0.2

Flutter Android iOS

A new Flutter plugin to fetch os proxy setting.

osproxysetting #

A new Flutter plugin to fetch os proxy setting.

Getting Started #

This project is a starting point for a Flutter plug-in package, a specialized package that includes platform-specific implementation code for Android and/or iOS.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Usage #

U can use this plugin to fetch system proxy settings. And can set HttpClient's findProxy method, so that u can use Charles(or other tools) to wireshark.

Example in use dio in Flutter or other libary use HttpCilent.

First, add dependency to your pubspec.yaml

osproxysetting: ^0.0.1

Then set findProxy function.

if (_debugMode) {
    (_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
        (client) async {
    client.findProxy = (uri) {
        final setting = OsProxySetting.cacheSetting();
        if (setting == null ||
            !setting.httpEnable ||
            setting.port == null ||
            setting.host == null) {
        return "DIRECT";
        }
        return "PROXY ${setting.host}:${setting.port}";
    };
    };
}
0
likes
80
pub points
32%
popularity

A new Flutter plugin to fetch os proxy setting.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

logasync@gmail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on osproxysetting