executeCommand method

  1. @override
Future<bool> executeCommand(
  1. String command, [
  2. String? player
])
override

Implementation

@override
Future<bool> executeCommand(String command, [String? player]) async {
  try {
    final args = player != null ? ['--player=$player', command] : [command];
    final result = await Process.run('playerctl', args, runInShell: true);
    return result.exitCode == 0;
  } catch (e) {
    debugPrint('Error executing command $command: $e');
    throw CommandExecutionException(command, null, e);
  }
}