Skip to content
pubscout

native_flutter_proxy

0.3.1, released 11 months ago by an unverified publisher

Read and set system network proxy info from native on Android and iOS.

$ flutter pub add native_flutter_proxy
Source repository

What it does

A Flutter plugin to read system proxy settings from native code and apply them in Dart. It configures HttpOverrides.global with either the system proxy or a custom proxy and supports auto-updates when the system proxy changes.

AI-written summary of version 0.3.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to read system proxy settings on Android and iOS.
  • You want your app to automatically react when the system proxy changes.

Skip it when

  • You do not need network proxy configuration or system proxy detection.

Strengths

  • Reads system proxy settings on both Android and iOS.
  • Provides automatic updates when the system proxy changes via callback.
  • Allows forcing a custom proxy for debugging.

Weaknesses

  • Limited to Android and iOS platform support.
  • Documentation does not detail additional platform setups.

Setup

Kind
Plugin (native code)
Effort
Low
Code generation
No
Direct dependencies
0

Add native_flutter_proxy to pubspec.yaml and initialize the reader and callback in main.

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

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  try {
    final settings = await NativeProxyReader.proxySetting;
    if (settings.enabled && settings.host != null) {
      CustomProxy(ipAddress: settings.host!, port: settings.port).enable();
    }
  } catch (e) {
    print(e);
  }
  runApp(MyApp());
}

Alternatives

Packages that do the same job and could replace native_flutter_proxy.

  • http2

    An HTTP/2 implementation in Dart for low-level transport and pooled HTTP/2 requests.

  • public_ip_address

    Get public IP addresses and associated geolocation data like country, city, timezone, and ISP.

  • pretty_http_logger

    Middleware logger for Dart's http package that prints requests and responses in a readable format.

  • pretty_dio_logger

    A Dio interceptor that logs network calls in a pretty, easy to read format.