state static method

Future<VpnState> state()

Implementation

static Future<VpnState> state() async {
  if (!Platform.isAndroid) return vpnByName();
  try {
    return switch (await _channel.invokeMethod<String>('vpnState')) {
      'locked' => VpnState.locked,
      'on' => VpnState.on,
      _ => VpnState.none,
    };
  } on MissingPluginException {
    return vpnByName();
  } on PlatformException {
    return vpnByName();
  }
}