detect_proxy_setting 0.0.9
detect_proxy_setting: ^0.0.9 copied to clipboard
This package detect proxy setting for http. Supported os are Android, iOS, MacOS, Windows.
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.