which static method
Find the full path to a command using which (or where on Windows).
Implementation
static Future<String?> which(String command) async {
try {
final cmd = Platform.isWindows ? 'where' : 'which';
final result = await Process.run(cmd, [command]);
if (result.exitCode == 0) {
return (result.stdout as String).trim().split('\n').first;
}
} catch (_) {}
return null;
}