MethodChannelFlutterV2ray class
An implementation of FlutterV2rayPlatform that uses method channels.
- Inheritance
-
- Object
- PlatformInterface
- FlutterV2rayPlatform
- MethodChannelFlutterV2ray
Constructors
Properties
- eventChannel → EventChannel
-
The event channel used to receive status updates from the native platform.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- methodChannel → MethodChannel
-
The method channel used to interact with the native platform.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearLogs(
) → Future< bool> -
Clears the V2Ray logs from the system logcat.
Returns a Future that completes with a bool indicating success.
On non-Android platforms, returns true.
override
-
getConnectedServerDelay(
String url) → Future< int> -
Measures the delay to the currently connected V2Ray server.
urlis the server URL to test. Returns a Future that completes with the delay in milliseconds.override -
getCoreVersion(
) → Future< String> -
Retrieves the version of the V2Ray core.
Returns a Future that completes with a String representing the core version.
override
-
getLogs(
) → Future< List< String> > -
Retrieves V2Ray logs from the system logcat.
Returns a Future that completes with a List of log lines.
On non-Android platforms, returns an empty list.
override
-
getServerDelay(
{required String config, required String url}) → Future< int> -
Measures the delay to a V2Ray server using the provided configuration and URL.
configis the V2Ray configuration in JSON format.urlis the server URL to test. Returns a Future that completes with the delay in milliseconds.override -
initializeV2Ray(
{required void onStatusChanged(V2RayStatus status), required String notificationIconResourceType, required String notificationIconResourceName}) → Future< void> -
Initializes the V2Ray client with a status change callback and notification settings.
onStatusChangedis a callback that will be invoked when the V2Ray status changes.notificationIconResourceTypespecifies the type of the notification icon resource (e.g., 'mipmap').notificationIconResourceNamespecifies the name of the notification icon resource (e.g., 'ic_launcher'). Returns a Future that completes when initialization is done.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requestPermission(
) → Future< bool> -
Requests permission to use V2Ray features, such as VPN access.
Returns a Future that completes with a bool indicating whether permission was granted.
override
-
startV2Ray(
{required String remark, required String config, required String notificationDisconnectButtonName, List< String> ? blockedApps, List<String> ? bypassSubnets, bool proxyOnly = false}) → Future<void> -
Starts the V2Ray connection with the given configuration and settings.
remarkis a string identifier for the connection.configis the V2Ray configuration in JSON format.notificationDisconnectButtonNameis the text for the disconnect button in notifications.blockedAppsis an optional list of apps to block.bypassSubnetsis an optional list of subnets to bypass.proxyOnlyis a boolean indicating whether to use proxy-only mode (default is false). Returns a Future that completes when the connection starts.override -
stopV2Ray(
) → Future< void> -
Stops the V2Ray connection.
Returns a Future that completes when the connection is stopped.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited