desktop_proxy 1.0.1
desktop_proxy: ^1.0.1 copied to clipboard
Resolves the system proxy for a given URL on Windows and macOS.
desktop_proxy #
A Flutter plugin that resolves the system proxy configuration for a given URL on Windows and MacOS.
Features #
- Single API:
getProxyForUrl(Uri)returns the proxy to use, ornullfor a direct connection (DIRECT). - Federated plugin structure with native entry points for Windows (C++) and
macOS (Swift).
Supported platforms #
| Platform | Status |
|---|---|
| Windows | ✅ |
| macOS | ✅ |
Installation # #
Add desktop_proxy to your pubspec.yaml:
dependencies:
desktop_proxy: ^latest_version
Usage #
import 'package:desktop_proxy/desktop_proxy.dart';
final desktopProxy = DesktopProxy();
final Uri? proxy = await desktopProxy.getProxyForUrl(
Uri.parse('https://example.com'),
);
if (proxy == null) {
// No proxy configured - connect directly (DIRECT).
} else {
// Route the request through `proxy`, e.g. http://proxy.corp:8080
}
API #
Future<Uri?> getProxyForUrl(Uri url);
Returns the proxy Uri for url, or null when the connection should be made
directly.