detect_proxy_setting 0.0.8 copy "detect_proxy_setting: ^0.0.8" to clipboard
detect_proxy_setting: ^0.0.8 copied to clipboard

This package detect proxy setting for http. Supported os are Android, iOS, MacOS, Windows.

pub package

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: proxy or direct
  • isAutoDetect: whether automatic proxy detection is enabled
  • proxy: proxy host and port such as proxy.example.com:8080
  • proxyBypass: bypass list when provided by the platform
  • configUrl: PAC or auto-config URL when provided by the platform

See example/lib/main.dart for a complete example app.