stopVpn method

  1. @override
Future<void> stopVpn()
override

Implementation

@override
Future<void> stopVpn() async {
  assert(
    (await isConnected()),
    'Bad state: vpn has not been started. Call startVpn',
  );
  _setStage(VpnStage.disconnecting);
  try {
    await shell
        .run('sudo wg-quick down ${configFile?.path ?? (await filePath)}');
  } catch (e) {
    await refreshStage();
    rethrow;
  }
  await refreshStage();
}