http_proxy_override 1.0.1 copy "http_proxy_override: ^1.0.1" to clipboard
http_proxy_override: ^1.0.1 copied to clipboard

A plugin that get the proxy settings from system.

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:http_proxy_override/http_proxy_override.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  HttpProxyOverride httpProxyOverride =
      await HttpProxyOverride.createHttpProxy();
  HttpOverrides.global = httpProxyOverride;
  runApp(MyApp(
    httpProxyOverride.host,
    httpProxyOverride.port,
  ));
}

class MyApp extends StatefulWidget {
  MyApp(this.host, this.port);
  late final String? host;
  late final String? port;
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            children: [
              Text('Host: ${widget.host}'),
              Text('Port: ${widget.port}'),
            ],
          ),
        ),
      ),
    );
  }
}
9
likes
150
pub points
87%
popularity

Publisher

unverified uploader

A plugin that get the proxy settings from system.

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on http_proxy_override