FLUTTER ECOSYSTEM

vicdotdevelop/native_flutter_proxy

उपकरण प्रॉक्सी जानकारी प्राप्त करने के लिए एक प्लगइन।

native_flutter_proxy प्रोजेक्ट कवर
Stars
17
Forks
19
अंतिम पुश (UTC)
24 दिस॰ 2025
प्रोजेक्ट स्थिति
सक्रिय
Victor GitHub avatar
GITHUB User

Victor ↗

Developer Advocate for AI augmented coding 🚀

Frankfurt, Germany
भाषाएँDartSwiftKotlinRubyObjective-C

तकनीकी विषय

उपयोग की गई निर्भरताएँ

निर्भरता सूची 3 आइटम
  • flutter{"sdk":"flutter"}
  • flutter_testडेवलपमेंट{"sdk":"flutter"}
  • very_good_analysisडेवलपमेंट^10.0.0

मूल README

यह अंग्रेज़ी मूल स्नैपशॉट है। नवीनतम सामग्री GitHub पर देखें।

README खोलें / बंद करें

Pub Version

native_flutter_proxy

A Flutter plugin to read system proxy settings from native code and apply them in Dart. Use it to configure HttpOverrides.global with either the system proxy or a custom proxy.

Key features:

  • Read system proxy settings on Android and iOS.
  • Auto-update when the system proxy changes via NativeProxyReader.setProxyChangedCallback.
  • Apply a custom proxy using CustomProxy / CustomProxyHttpOverride.

Installing

You should add the following to your pubspec.yaml file:

dependencies:
  native_flutter_proxy: ^0.3.0

Quick Start

import 'dart:io';

import 'package:flutter/widgets.dart';
import 'package:native_flutter_proxy/native_flutter_proxy.dart';

Future<void> applyProxy(ProxySetting settings) async {
  if (!settings.enabled || settings.host == null) {
    HttpOverrides.global = null;
    return;
  }

  CustomProxy(ipAddress: settings.host!, port: settings.port).enable();
}

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  try {
    final settings = await NativeProxyReader.proxySetting;
    await applyProxy(settings);
  } catch (e) {
    print(e);
  }

  NativeProxyReader.setProxyChangedCallback((settings) async {
    await applyProxy(settings);
  });

  runApp(MyApp());
}

Auto-update on proxy changes

NativeProxyReader.setProxyChangedCallback is invoked whenever the system proxy changes, so your app can react immediately (including PAC-based proxies on Android). Register it once at startup and update your overrides there.

Manual proxy (optional)

If you want to force a proxy (e.g. for debugging), you can set it directly:

final proxy = CustomProxy(ipAddress: '127.0.0.1', port: 8888);
proxy.enable();

For a full example, see example/lib/main.dart.