flutter_sing_box 2.0.1
flutter_sing_box: ^2.0.1 copied to clipboard
A Flutter plugin for sing-box, supporting remote profile import, Clash API, and VPN service management for Android and iOS.
2.0.1 #
Documentation #
- Update the showcase project name (
clash_sing→clash-sing) in README / README_CN to match the renamed repository
2.0.0 #
⚠️ Breaking change #
ProxyStateis now asealed class(was an enum); each state is its ownfinal class:ProxyStopped/ProxyStarting/ProxyStarted/ProxyStoppingProxyStoppedcarries a nullableerrMessage(non-null = abnormal stop, e.g. start failure or core crash) with value-based==/hashCode; the other three states are const singletons- Existing
== ProxyState.started-style comparisons keep working via preservedstatic constcompatibility constants (ProxyState.stopped/.starting/.started/.stopping); exhaustive switches over the old enum must migrate to type patterns (case ProxyStopped():) - The
namegetter andfromName()keep their original semantics
- Windows:
start()/restart()no longer throw on failure; the failure reason is emitted asProxyStopped(errMessage: ...)onproxyStateStream(also resetting the state machine fromstarting), making the state stream the single source of truth for startup failures — aligned with the Android native alert path; callers awaiting these futures can no longer catch failures from the returned future
Features #
- Android
proxyStateStream: abnormal-stop events from the native side (EventSink.error(code: "Stopped", message)) now surface their error message asProxyStopped.errMessageinstead of being swallowed
1.3.0 #
Dependencies #
- Upgrade sing-box core to
1.14.0: Android (libbox, jitpack)1.13.21→1.14.0; Windowssing-box.exe/libcronet.dllbinaries upgraded in sync
Compatibility (adapting to libbox 1.14.0 breaking API changes, aligned with upstream sing-box-for-android 1.14.0) #
PlatformInterface: remove the deletedsystemCertificates(); add default implementations for 13 new interface methods (shell / bridge / neighbor-table monitoring, etc., treated as "unsupported");getInterfaces()now includesgatewayinfoTunOptions:dnsServerAddresschanged from a single value to an iterator;openTunmigrated todnsMode+ multiple DNS server writesCommandServerHandler: implementtriggerNativeCrash()/connectSSHAgent()CommandClientHandler: implementwriteOutbounds()(this plugin does not subscribe to that command; empty implementation)- Notification API:
identifiersemantics changed to a notification tag; thesendNotificationchannel is now derived fromtypeID; addcancelNotification - Remove the
Libbox.redirectStderr()call deleted by libbox (Setup()now redirects stderr toCrashReport-<source>.logautomatically)
Features #
- Configuration model extensions, adding sing-box 1.14.0 fields:
DnsRule: addrace/rcode/tagfields;actionmade nullable with theRuleAction.routedefault removed;rulesnarrowed toList<DnsRule>;matchResponserelaxed todynamicRouteRule:actionmade nullable with theRuleAction.routedefault removedRuleSet: add localrules(inline rule-set); remove the deprecateddownloadDetourOutbound: addhopInterval/hopIntervalMax/bbrProfile/disableChromeParrot/realm(Hysteria2-related) fieldsRoute/SingBox: adddefaultHttpClient/httpClientsfieldsClientGroupItem:tag/typechanged to mutable fields
⚠️ Runtime behavior notes #
- sing-box 1.14.0 hard-removes the legacy DNS server format (legacy
dns.servers) deprecated since 1.12: old-format configs fail immediately at startup; user configs must use the new DNS format (the new format generated by the Clash/Base64 config converters in this plugin is unaffected)
1.2.0 #
🎉 Milestone: official Windows platform support #
Promoted from the "in development" state of 1.1.5 to officially usable: the desktop hosts the sing-box process as a system service, with system proxy settings and real-time Clash API logs.
⚠️ Breaking Changes #
- Minimum environment requirements raised: Dart SDK
^3.11.0→^3.12.0, Flutter>=3.41.0→>=3.44.0
Features #
- Official Windows platform support:
- Add
SystemProxyService: set/clear the Windows system proxy via FFI - Add the
ProxyModeenum and thedefaultMixedPortconstant;CsSettingsStorageaddsproxyMode/mixedPort/systemProxyActivesettings emitProxyStatelinked with system proxy on/off;initadds crash self-recovery logic- Add Clash API real-time log subscription (
logStream): WebSocket-based connection to the/logsendpoint with automatic reconnection and a custom API port
- Add
- Resource extraction enhancements: compare the SHA256 of resources and target files in memory to avoid temp-file writes and cleanup; for running exes exclusively locked on Windows (errno 32), fall back to renaming the old file to
.oldbefore writing the new one - Network layer
DioClientadds anallowBadCertificatesswitch to control certificate validation at runtime, fixing request failures on the Windows desktop caused by incomplete certificate chains of subscription sites
Fixes #
- Fix the Windows Clash log level mapping error (
warning→warn) - Fix missing
awaiton asynchronous calls in Windows service operations (status check, install, uninstall, start, stop) and resource copy methods
Improvements #
- Migrate the Android build script from Groovy (
build.gradle) to Kotlin DSL (build.gradle.kts), requiring AGP 9.0.1 / Kotlin 2.3.20 / Java 17 - Remove unnecessary Android permissions
- Simplify the Windows platform asset configuration in pubspec.yaml
- Example: upgrade the Android build toolchain (Gradle / AGP / Kotlin / SDK); migrate the UI layer from
flutter/materialto material_ui
Dependencies #
- Upgrade the sing-box core (Android
libbox/ Windowssing-box.exe):1.13.15→1.13.21 - Upgrade MMKV:
2.4.1→2.4.2(2.4.1 has an MSVC cbridge crash on Windows) - Upgrade
dio: →^5.11.1 - Remove the
path_providerdependency
1.1.5 #
Features #
- Add Windows platform support (in development; the desktop hosts the sing-box process as a system service, compensating for the lack of a VPN Service on desktop platforms):
- Add service management APIs:
installService/uninstallService/queryServiceStatus, installed via PowerShell runas elevation with status polling to determine the result - Implement Windows VPN control and proxy state listening (
proxyStateStream) - Add
HelperCli, wrapping all CLI subcommands ofclash_sing_helper.exe(status / stop / install / uninstall / start)
- Add service management APIs:
- Windows Clash API support:
- Add Clash configuration models and an HTTP client
- Implement Clash mode reading and switching (
clashModeStream,setClashMode) - Implement proxy group fetching, outbound switching and URL latency testing
- The storage layer adds Clash API port and test URL settings
Improvements #
- Upgrade Android
libbox(sing-box core):1.13.14→1.13.15 - Upgrade Windows
sing-box.exeto1.13.15 - The Clash API port adapts to changes dynamically
- Remove the unused location permission on Android
Fixes #
- Fix the Windows Clash HTTP client proxy type mapping error
- Fix Windows Clash proxy group parsing and type conversion logic
Refactoring #
- Refactor the service install API: parameters collapsed into a
HelperConfigobject; hardcoded paths extracted into constants - Promote service management capabilities (uninstall / start / stop) to the platform abstraction layer and facade
- Optimize proxy state stream controller initialization and state dispatch logic
FlutterSingBoxWindowsdelegates toHelperCli, removing the migrated helper methods
Dependencies #
- Upgrade
dio: →^5.10.0
1.1.3 #
Features #
- Add naive protocol outbound type support
- Add a standalone TLS configuration model (
tls.dart) - Add a
domainResolverfield to the Outbound model - Add
domain_resolverandtlsfields to the DNS Server model
Fixes #
- Fix the DNS Server model
pathfield type:List<String>→String
Improvements #
- Remove the
sniff_override_destinationoption from the sing-box template config
1.1.2 #
Documentation #
- Fully document public APIs with English dartdoc comments, covering constants, providers, services, network, storage, etc., improving the pub.flutter-io.cn documentation coverage score
Dependencies #
- Upgrade
device_info_plus:^12.2.0→^13.1.0 - Upgrade
package_info_plus:^9.0.0→^10.1.0
1.1.0 #
⚠️ Breaking Changes #
- Minimum environment requirements raised: Dart SDK
^3.9.0→^3.11.0, Flutter>=3.3.0→>=3.41.0 - Fix the Android plugin package name typo:
com.clashsiing.flutter_sing_box→com.clashsing.flutter_sing_box(update native references or consumer-rules configurations accordingly, if any) - Introduce the freezed code generation framework, adding
freezedandfreezed_annotationdependencies
Features #
- Add Rule Set configuration support and optimize the sing-box config template structure
- Support a custom User-Agent for subscription requests, with a built-in default User-Agent generator
- Greatly extend the sing-box configuration model fields: Outbound adds
username,quic, etc.; DNS / Route models gain many additional fields - Add a standalone storage module with the
KeyValueStorageabstract interface (MMKV / Memory implementations) - Add
CsSettingsStoragefor per-app proxy settings - Add the
ClientLogdata model - Profile adds the
outboundsCountfield and supports fetching all Profile IDs - Add the
defaultTestUrlconstant
Improvements #
- Cache the sing-box version string to avoid repeated fetches (performance optimization)
- Add
explicitToJsonto models, fixing JSON serialization of nested models - Refactor the VPN service startup logic, caching event stream state
- Upgrade JSON serialization dependencies:
json_annotation→ 4.12.0,json_serializable→ 6.14.0 - Remove the
android:process=":remote"attribute from VpnService
Fixes #
- Fix VPN service restart
- Fix Clash mode setting and connection management issues
- Fix the Android service shutdown logic
- Add a null guard for
logSinkinappendLogsto avoid a null pointer exception
Refactoring #
- Refactor the storage layer:
ProfileManagerrenamed toProfileStorage, replacing direct MMKV calls with theKeyValueStorageabstract interface - Migrate
ClientGroupItem/ClientGroupto freezed data classes - Make some Route and RuleSet fields optional for flexibility
- Refactor the Android service implementation and update dependencies
- Clean up the deprecated custom module and debug code
1.0.12 #
Features #
- Add app-level proxy mode (disable / exclude / include)
- Support per-app proxy rules via the app list
Improvements #
- Update the MMKV dependency to 2.4.0
- Optimize app list storage (JSON array format)
- Update the Android build environment (Kotlin 2.3.20, Gradle 8.14.4)
Refactoring #
- Remove the
snifffield from the Inbound model - Refactor the app list data structure (List/Set conversion optimization)
1.0.11 #
- Update
sing-boxdependency to1.12.25for Android.
1.0.10 #
- Route Rule: Added IP CIDR and port filtering support
- New fields:
ip_cidr,source_ip_cidr,port,port_range,source_port,source_port_range - Enhanced traffic matching with IP and port-based routing
- Full JSON serialization support with backward compatibility
- New fields:
1.0.9 #
Features #
- Add DNS rule action configuration and new domain matching fields
- Add
RuleActionconstants for routing rules
Improvements #
- Optimize proxy configuration template and simplify DNS/route rules
- Adjust default log level from
tracetoinfo - Update User-Agent string for better compatibility
Refactoring #
- Remove remote rule set configuration (geoip-cn, geosite-cn)
- Simplify configuration structure and improve performance
- Make Route fields optional for flexibility
1.0.8 #
- Update
sing-boxdependency to1.12.24for Android.
1.0.7 #
- Update
sing-boxdependency to1.12.23for Android.
1.0.6 #
- Update
sing-boxdependency to1.12.22for Android.
1.0.5 #
- Update
sing-boxdependency to1.12.20for Android.
1.0.4 #
- Update
libboxdependency to1.12.19for Android. - Update documentation and project links in README.
- Bump version to 1.0.4.
1.0.3 #
- Add
getSingBoxVersion()API to retrieve the underlying sing-box core version. - Optimize memory usage and stability for long-running VPN services.
- Improve error handling during remote profile synchronization.
- Update dependencies to latest versions (dio, mmkv, package_info_plus, etc.).
- Minor bug fixes and performance improvements.
1.0.2 #
- Improve package description and API documentation coverage to increase pub score.
- Add comprehensive README with features, platform support, and basic usage.
- Add Chinese documentation (
README_CN.md). - Showcase projects using this plugin (clash_sing_app).
1.0.0 #
- Initial release of the
flutter_sing_boxplugin. - Support for sing-box as a VPN service.
- Ability to import remote profiles.
- Clash API support for managing proxies and groups.
- UI for managing profiles and viewing connection status.
- Support for various protocols like Hysteria, TUIC, etc.
- Core functionalities like network service, profile management, and custom logging.
- Many bug fixes and performance improvements.