MethodChannelSingBox class
An implementation of SingBoxPlatform that uses method channels.
- Inheritance
-
- Object
- PlatformInterface
- SingBoxPlatform
- MethodChannelSingBox
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- methodChannel → MethodChannel
-
The method channel used to interact with the native platform.
final
- notificationsEventChannel → EventChannel
-
Event channel for notifications
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- statsEventChannel → EventChannel
-
Event channel for connection stats updates
final
- statusEventChannel → EventChannel
-
Event channel for connection status updates
final
Methods
-
addAppToBypass(
String packageName) → Future< bool> -
Add app to bypass list (will not use VPN)
packageName- app package name (Android) or bundle ID (iOS)override -
addBlockedApp(
String packageName) → Future< bool> -
Add app to blocked list
packageName- app package name (Android) or bundle ID (iOS)override -
addBlockedDomain(
String domain) → Future< bool> -
Add domain/site to blocked list
domain- domain name or IP addressoverride -
addDnsServer(
String dnsServer) → Future< bool> -
Add DNS server
dnsServer- DNS server IP address (e.g., "8.8.8.8", "1.1.1.1")override -
addDomainToBypass(
String domain) → Future< bool> -
Add domain/site to bypass list (will not use VPN)
domain- domain name or IP addressoverride -
addServerConfig(
SingBoxServerConfig config) → Future< bool> -
Add server configuration
config- server configurationoverride -
addSubnetToBypass(
String subnet) → Future< bool> -
Add subnet to bypass list (will not use VPN)
subnet- subnet in CIDR notation (e.g., "192.168.1.0/24", "10.0.0.0/8")override -
connect(
String config) → Future< bool> -
Connect to VPN with specified configuration
config- JSON string with server configurationoverride -
disconnect(
) → Future< bool> -
Disconnect from VPN
override
-
getActiveSingBoxServerConfig(
) → Future< SingBoxServerConfig?> -
Get active server configuration
override
-
getBlockedApps(
) → Future< List< String> > -
Get list of blocked apps
override
-
getBlockedDomains(
) → Future< List< String> > -
Get list of blocked domains/sites
override
-
getBypassApps(
) → Future< List< String> > -
Get list of apps in bypass
override
-
getBypassDomains(
) → Future< List< String> > -
Get list of domains/sites in bypass
override
-
getBypassSubnets(
) → Future< List< String> > -
Get list of subnets in bypass
override
-
getConnectionStats(
) → Future< SingBoxConnectionStats> -
Get current connection statistics
override
-
getConnectionStatus(
) → Future< SingBoxConnectionStatus> -
Get current connection status
override
-
getDnsServers(
) → Future< List< String> > -
Get list of DNS servers
override
-
getPlatformVersion(
) → Future< String?> -
Get platform version
override
-
getServerConfig(
String configId) → Future< SingBoxServerConfig?> -
Get server configuration by ID
configId- configuration identifieroverride -
getServerConfigs(
) → Future< List< SingBoxServerConfig> > -
Get all server configurations
override
-
getSettings(
) → Future< SingBoxSettings> -
Get current settings
override
-
initialize(
) → Future< bool> -
Initialize plugin
Must be called before using other methods, preferably before application start
override
-
loadSettings(
) → Future< SingBoxSettings> -
Load settings
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pingCurrentServer(
) → Future< SingBoxPingResult> -
Measure ping to current server
override
-
removeAppFromBypass(
String packageName) → Future< bool> -
Remove app from bypass list
packageName- app package name (Android) or bundle ID (iOS)override -
removeBlockedApp(
String packageName) → Future< bool> -
Remove app from blocked list
packageName- app package name (Android) or bundle ID (iOS)override -
removeBlockedDomain(
String domain) → Future< bool> -
Remove domain/site from blocked list
domain- domain name or IP addressoverride -
removeDnsServer(
String dnsServer) → Future< bool> -
Remove DNS server
dnsServer- DNS server IP addressoverride -
removeDomainFromBypass(
String domain) → Future< bool> -
Remove domain/site from bypass list
domain- domain name or IP addressoverride -
removeServerConfig(
String configId) → Future< bool> -
Remove server configuration
configId- configuration identifieroverride -
removeSubnetFromBypass(
String subnet) → Future< bool> -
Remove subnet from bypass list
subnet- subnet in CIDR notationoverride -
saveSettings(
SingBoxSettings settings) → Future< bool> -
Save settings
settings- settings object to saveoverride -
setActiveServerConfig(
String configId) → Future< bool> -
Set active server configuration
configId- configuration identifieroverride -
setDnsServers(
List< String> dnsServers) → Future<bool> -
Set DNS servers (replaces all existing DNS servers)
dnsServers- list of DNS server IP addressesoverride -
switchServer(
String config) → Future< bool> -
Switch current server
Stops current connection, changes configuration and connects to new server
config- JSON string with new server configurationoverride -
testSpeed(
) → Future< SingBoxSpeedTestResult> -
Measure connection speed
override
-
toString(
) → String -
A string representation of this object.
inherited
-
updateServerConfig(
SingBoxServerConfig config) → Future< bool> -
Update server configuration
config- updated server configurationoverride -
updateSetting(
String key, dynamic value) → Future< bool> -
Update individual setting parameter
key- parameter key (autoConnectOnStart, autoReconnectOnDisconnect, killSwitch)value- parameter valueoverride -
watchNotifications(
) → Stream< SingBoxNotification> -
Subscribe to notifications from sing-box
Returns Stream with notification updates
override
-
watchSingBoxConnectionStats(
) → Stream< SingBoxConnectionStats> -
Subscribe to connection statistics changes
Returns Stream with statistics updates
Statistics include: download/upload speed, bytes sent/received, ping, connection duration
override
-
watchSingBoxConnectionStatus(
) → Stream< SingBoxConnectionStatus> -
Subscribe to connection status changes
Returns Stream with status updates
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited