isConnected method

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

Implementation

@override
Future<bool> isConnected() async {
  assert(
    name != null,
    'Bad state: not initialized. Call "initialize" before calling this command',
  );
  final processResultList = await shell.run('sudo wg');
  final process = processResultList.first;
  return process.outLines.any((line) => line.trim() == 'interface: $name');
}