installCommand static method
Checks if command
is executable on this system.
Implementation
static bool installCommand(String command) {
String installCmd = '';
List<String> installArgs = [];
switch (command) {
case 'collect_coverage':
case 'format_coverage':
installCmd = 'dart';
installArgs = ['pub', 'global', 'activate', 'coverage'];
break;
default:
return false;
}
final result = Process.runSync(installCmd, installArgs, runInShell: true);
return result.exitCode == 0 && result.stdout.toString().trim().isNotEmpty;
}