flutter_sing_box 1.0.3 copy "flutter_sing_box: ^1.0.3" to clipboard
flutter_sing_box: ^1.0.3 copied to clipboard

A Flutter plugin for sing-box, supporting remote profile import, Clash API, and VPN service management for Android and iOS.

flutter_sing_box #

pub package license

English | 中文简体

A powerful Flutter plugin for sing-box, the universal proxy platform.

🚀 Projects Using This Plugin #

  • clash_sing_app: A full-featured GUI client based on sing-box and Clash, providing a powerful and intuitive user experience.

Features #

  • VPN Service Management: Easily start and stop VPN services on supported platforms.
  • Advanced Configuration Support:
    • Native sing-box: Direct support for native JSON configurations.
    • YAML to sing-box: Automatic conversion of Clash-style YAML configurations.
    • Base64 to sing-box: Seamless parsing of Base64 encoded subscription links.
  • Profile Management: Import, manage, and switch between local and remote profiles (subscription links).
  • Clash API Support: Full support for Clash-compatible API for managing proxies, groups, and selecting outbounds.
  • Real-time Monitoring: Monitor connection status, traffic (uplink/downlink), and logs in real-time via streams.
  • Multi-Protocol Support: Inherits support for various protocols from sing-box, including Hysteria, TUIC, WireGuard, Shadowsocks, and more.

Platform Support #

Platform Support Status
Android Production Ready
iOS Planned
Windows ☐️ Planned
macOS ☐️ Planned
Linux Planned

Getting Started #

Installation #

Add flutter_sing_box to your pubspec.yaml:

dependencies:
  flutter_sing_box: ^1.0.3

Initialization #

Initialize the plugin in your main() function:

import 'package:flutter_sing_box/flutter_sing_box.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await FlutterSingBox().init();
  runApp(MyApp());
}

Basic Usage #

Start VPN

try {
  await FlutterSingBox().startVpn();
} catch (e) {
  print("Failed to start VPN: $e");
}

Stop VPN

await FlutterSingBox().stopVpn();

Listen to Status

FlutterSingBox().connectedStatusStream.listen((status) {
  print("Uplink: ${status.uplink}, Downlink: ${status.downlink}");
});

Example #

Check out the example directory for a complete demo application using Riverpod for state management.

Contributing #

Contributions are welcome! Please feel free to submit a Pull Request or open an issue if you encounter any bugs or have feature requests.

License #

This project is licensed under the GPL-3.0 License.

2
likes
160
points
214
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin for sing-box, supporting remote profile import, Clash API, and VPN service management for Android and iOS.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

collection, device_info_plus, dio, flutter, json_annotation, mmkv, package_info_plus, path, path_provider, plugin_platform_interface, yaml

More

Packages that depend on flutter_sing_box

Packages that implement flutter_sing_box