VOOZH about

URL: https://dev.to/amirzr/fluttersingboxclient-a-modern-flutter-vpn-proxy-plugin-built-on-sing-box-4omj

⇱ flutter_singbox_client: A Modern Flutter VPN & Proxy Plugin Built on Sing-box - DEV Community


A stateless, event-driven Dart wrapper for the Sing-box proxy core β€” TUN VPN mode, kill switch, Clash API, per-app proxy, and native support for WireGuard, Hysteria2, TUIC, VMess, VLESS, Trojan, Shadowsocks, and more, all in one Flutter plugin.


πŸ‘‹ Hey Flutter Fam!

If you've been following my journey, you know I shipped flutter_v2ray_client not too long ago β€” and the community response was absolutely incredible. Thank you! πŸ™

But you kept asking me one thing:

"Amir, when are you bringing **sing-box* to Flutter?"*

Well β€” today is that day. πŸŽ‰

I'm beyond excited to introduce flutter_singbox_client β€” a powerful, modern Flutter VPN plugin and Flutter proxy library that wraps the Sing-box universal proxy core with a clean, stateless, event-driven Dart API.

Whether you're building a censorship-bypass VPN app, a privacy tool, or a custom proxy client in Flutter, this plugin gives you a production-ready foundation. 🌟


πŸ€” Why Sing-box for a Flutter VPN App?

V2Ray and Xray got us far β€” but the proxy world has evolved dramatically. Sing-box is the new gold standard for proxy cores:

  • Broader protocol coverage (WireGuard, Hysteria2, TUIC, etc.)
  • Better performance and modern TLS features (uTLS, Reality, ECH)
  • Actively maintained open-source community
  • Future-proof for years to come

If you're choosing a Flutter VPN library or a Flutter proxy library in 2026, Sing-box is the most future-proof core to build on. πŸ’œ


✨ Key Features

πŸ”’ VPN Mode β€” Full device-wide TUN tunnel via Android VpnService

🌐 Proxy Mode β€” HTTP/SOCKS proxy without a TUN device β€” no VPN permission required

βš”οΈ Clash API β€” Runtime mode switching and outbound group control with latency testing

πŸ“± Per-App Proxy β€” Include or exclude specific apps from the tunnel (split tunneling)

🌍 System Proxy β€” Register HTTP inbound as device-wide proxy on Android Q+

πŸ”‘ Kill Switch β€” Block all traffic at the OS level when the tunnel is down

πŸ“Š Live Traffic β€” Real-time upload/download speeds and session totals at ~1 Hz

πŸ”Œ Connection Tracking β€” Full per-connection metadata, lifecycle, and close control

πŸ“‹ Live Logs β€” Real-time Go core log streaming with per-level filtering

⚠️ Fault Alerts β€” Dedicated fault stream for actionable service errors

🧠 Memory Limits β€” Go runtime soft memory cap (GOMEMLIMIT) with optional connection kill

πŸ§ͺ Network Testing β€” Built-in STUN (NAT type, latency) and network quality (speed, RPM) tests

βœ… Config Validation β€” Go core validation and JSON formatting before connecting

πŸ”„ Hot Reload β€” Reload config without restarting the service or dropping connections

πŸš€ Boot Auto-start β€” Boot broadcast relay so your app can reconnect after device restart

πŸ“¦ Zero Persistence β€” No database, no shared preferences, no file I/O for user data


🌐 Supported Protocols

Sing-box's protocol arsenal is unmatched. With flutter_singbox_client you get native support for:

VMess Β· VLESS Β· Trojan Β· Shadowsocks Β· Hysteria2 Β· TUIC Β· WireGuard Β· ShadowTLS Β· AnyTLS Β· Naive Β· Tor Β· SSH

Plus full support for V2Ray transports (WebSocket, gRPC, HTTPUpgrade, QUIC), TLS security (uTLS, Reality, ECH, ACME), FakeIP DNS, rule-based routing, and anti-censorship obfuscation.


πŸš€ Quick Start

1️⃣ Add to Your Project

dependencies:
 flutter_singbox_client: ^1.0.0

2️⃣ Configure Android

In android/app/build.gradle:

android {
 compileSdk 35
 defaultConfig { minSdk 23 }
 compileOptions {
 sourceCompatibility JavaVersion.VERSION_17
 targetCompatibility JavaVersion.VERSION_17
 }
 kotlinOptions { jvmTarget = "17" }
}

3️⃣ Initialize

import 'package:flutter_singbox_client/flutter_singbox_client.dart';

final client = SingboxClient();
await client.initialize();

4️⃣ Connect

await client.connect(SessionOptions(
 config: myConfigJson,
 networkMode: NetworkMode.vpn,
 killSwitch: true,
 notification: NotificationConfig(
 title: 'VPN Active',
 showTrafficStats: true,
 showStopButton: true,
 ),
));

5️⃣ Listen to Events

// Live traffic stats
client.trafficStatsStream.listen((stats) {
 print('↑ ${stats.uplinkBps} bps');
 print('↓ ${stats.downlinkBps} bps');
});

// Connection state
client.serviceStateStream.listen((state) {
 print('State: $state');
});

// Faults & errors
client.faultStream.listen((error) {
 print('Error: $error');
});

πŸ“Έ UI Showcase

Here's a peek at the production-ready example app:

πŸ‘


🎨 Real-World Use Cases

Imagine building:

Privacy-First Browsers πŸ›‘οΈ β€” Full TUN tunnel, zero traffic leaks

Secure Messaging Apps πŸ’¬ β€” Proxy layer over end-to-end encryption

Streaming Media Players πŸŽ₯ β€” Bypass geo-restrictions with Hysteria2

Corporate VPN Solutions 🏒 β€” Split tunneling for enterprise workflows

Censorship-Bypass Tools 🌍 β€” Reality + TUIC for the toughest networks

Developer Proxy Utilities βš™οΈ β€” Route debug traffic, inspect connections live


πŸ†š flutter_singbox_client vs flutter_v2ray_client

Core Engine: flutter_v2ray_client uses Xray, flutter_singbox_client uses Sing-box

Protocols:

  • Hysteria2: βœ… Both (v3.2+ in v2ray) vs βœ… Native in singbox
  • TUIC: ❌ Not in v2ray vs βœ… In singbox
  • WireGuard: ❌ Not in v2ray vs βœ… In singbox
  • ShadowTLS / AnyTLS: ❌ Not in v2ray vs βœ… In singbox
  • Tor / SSH: ❌ Not in v2ray vs βœ… In singbox

Advanced Features:

  • Kill Switch: ❌ Not in v2ray vs βœ… In singbox
  • Hot Config Reload: ❌ Not in v2ray vs βœ… In singbox
  • Clash API: ❌ Not in v2ray vs βœ… In singbox
  • Connection Tracking: ❌ Not in v2ray vs βœ… In singbox
  • STUN / Network Test: ❌ Not in v2ray vs βœ… In singbox
  • Boot Auto-start: ❌ Not in v2ray vs βœ… In singbox
  • System Proxy: ❌ Not in v2ray vs βœ… In singbox

Bottom Line: Both packages are great β€” but flutter_singbox_client is the evolution. If you're starting a new Flutter VPN project in 2026, this is the one to pick. πŸš€


❓ FAQ

What is flutter_singbox_client?
It's an open-source Flutter plugin that wraps the Sing-box proxy core in a stateless, event-driven Dart API. It lets Flutter developers build VPN and proxy apps with full TUN tunneling, kill switch, per-app proxy, and live traffic monitoring.

Is it free and open source?
Yes! GPL-3.0 on GitHub and pub.dev.

Which protocols does it support?
VMess, VLESS, Trojan, Shadowsocks, Hysteria2, TUIC, WireGuard, ShadowTLS, AnyTLS, Naive, Tor, and SSH β€” plus V2Ray transports and modern TLS features.

Does it support iOS?
iOS and macOS are in active development. Windows and Linux are planned. Android is fully supported today.

Can I use it in production?
Absolutely! It's built on Sing-box 1.14, supports Android API 23+, and is designed for production use.

Do I need root access?
No. Everything runs in user space through Android's standard VpnService API.


🌟 Tech Stack

Core Engine: Sing-box 1.14.0-alpha.20 (Go)

Android: API 23+ (Marshmallow), 16 KB page size βœ…

Flutter: >= 3.19.0

Dart: >= 3.3.0

Java Target: 17

License: GPL-3.0


πŸ—ΊοΈ Supported Platforms

Android: βœ… Done

iOS: πŸ”§ In Development

macOS: πŸ”§ In Development

Windows: πŸ—“ Planned

Linux: πŸ—“ Planned


πŸ”— Resources

flutter_singbox_client

flutter_v2ray_client (previous)


πŸ’¬ Share Your Thoughts

I'd love to hear from you in the comments:

  • Have you used Sing-box before? Which protocol is your go-to?
  • Are you building a VPN or proxy app? What features matter most?
  • Migrating from flutter_v2ray_client? What convinced you?
  • Privacy advocate? What's your biggest challenge when building censorship-bypass tools?

Drop your thoughts below β€” I read every single comment! πŸ‘‡


πŸ’ Support

If you found this helpful:

  • ⭐ Star the repo on GitHub
  • πŸ“’ Share this post with your network
  • πŸ’¬ Comment with your thoughts and questions
  • πŸ‘ React to show your support

Your support means everything! πŸ’œ


Let's build the future of private networking together! πŸš€

Follow me for more Flutter VPN/proxy content: