commandExists static method

Future<bool> commandExists(
  1. String command
)

Returns whether the specified command is available on the system.

Implementation

static Future<bool> commandExists(String command) async {
  try {
    final result = await Process.run('which', [command]);

    return result.exitCode == 0;
  } catch (_) {
    return false;
  }
}