existsCommand static method

Future<bool> existsCommand(
  1. String command
)

Implementation

static Future<bool> existsCommand(String command) async {
  if (Platform.isWindows) {
    var commandPath = WindowsUtil.commandPath(command);
    return commandPath != null;
  } else {
    var result = await Process.run('which', [command]);
    return result.exitCode == 0;
  }
}