detect_proxy_setting
Flutter plugin for reading the system HTTP proxy configuration.
Supported platforms:
- Android
- iOS
- macOS
- Windows
Installation
dependencies:
detect_proxy_setting: ^0.0.8
Usage
Read the current system proxy setting:
import 'package:detect_proxy_setting/detect_proxy_setting.dart';
final ProxySetting? setting = await proxySetting();
if (setting == null || setting.mode == ProxySettingModeEnum.direct) {
print('DIRECT');
} else {
print('PROXY ${setting.proxy}');
}
Resolve the proxy for a specific URL:
final ProxySetting? setting =
await proxySetting(url: 'https://example.com');
proxySetting() returns a ProxySetting with the following fields:
mode:proxyordirectisAutoDetect: whether automatic proxy detection is enabledproxy: proxy host and port such asproxy.example.com:8080proxyBypass: bypass list when provided by the platformconfigUrl: PAC or auto-config URL when provided by the platform
See example/lib/main.dart for a complete example app.
Libraries
- detect_proxy_setting
- Read the current system HTTP proxy configuration on the active platform.