FlutterV2rayPlatform class abstract
The interface that implementations of flutter_v2ray_client must implement.
Platform implementations should extend this class rather than implement it as flutter_v2ray_client
does not consider newly added methods to be breaking changes. Extending this class
(using extends
) ensures that the subclass will get the default implementation, while
platform implementations that implements
this interface will be broken by newly added methods.
- Inheritance
-
- Object
- PlatformInterface
- FlutterV2rayPlatform
- Implementers
Constructors
- FlutterV2rayPlatform.new()
- Constructs a FlutterV2rayPlatform.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
getConnectedServerDelay(
String url) → Future< int> -
Measures the delay to the currently connected V2Ray server.
url
is the server URL to test. Returns a Future that completes with the delay in milliseconds. -
getCoreVersion(
) → Future< String> - Retrieves the version of the V2Ray core. Returns a Future that completes with a String representing the core version.
-
getServerDelay(
{required String config, required String url}) → Future< int> -
Measures the delay to a V2Ray server using the provided configuration and URL.
config
is the V2Ray configuration in JSON format.url
is the server URL to test. Returns a Future that completes with the delay in milliseconds. -
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.
onStatusChanged
is a callback that will be invoked when the V2Ray status changes.notificationIconResourceType
specifies the type of the notification icon resource (e.g., 'mipmap').notificationIconResourceName
specifies the name of the notification icon resource (e.g., 'ic_launcher'). Returns a Future that completes when initialization is done. -
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.
-
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.
remark
is a string identifier for the connection.config
is the V2Ray configuration in JSON format.notificationDisconnectButtonName
is the text for the disconnect button in notifications.blockedApps
is an optional list of apps to block.bypassSubnets
is an optional list of subnets to bypass.proxyOnly
is a boolean indicating whether to use proxy-only mode (default is false). Returns a Future that completes when the connection starts. -
stopV2Ray(
) → Future< void> - Stops the V2Ray connection. Returns a Future that completes when the connection is stopped.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance ↔ FlutterV2rayPlatform
-
The default instance of FlutterV2rayPlatform to use.
getter/setter pair