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()
- 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
-
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.
-
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. -
getCoreVersion(
) → Future< String> - Retrieves the version of the V2Ray core. Returns a Future that completes with a String representing the core version.
-
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.
-
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. -
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. -
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.
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. -
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