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

一个方便设置flutter代理的插件,已适配新版本flutter

example/lib/main.dart

import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_core_httpproxy/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}'),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
145
points
12
downloads

Publisher

unverified uploader

Weekly Downloads

一个方便设置flutter代理的插件,已适配新版本flutter

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on flutter_core_httpproxy

Packages that implement flutter_core_httpproxy