isVpnActive method

  1. @override
Future<bool> isVpnActive()
override

Checks if the device is currently using a VPN connection.

Returns true if a VPN is active, false otherwise.

Implementation

@override
Future<bool> isVpnActive() async {
  try {
    final bool? result = await methodChannel.invokeMethod<bool>('isVpnActive');
    return result ?? false;
  } on PlatformException catch (e) {
    debugPrint('Failed to check VPN status: ${e.message}');
    return false;
  }
}