whichSync function

String? whichSync(
  1. String command, {
  2. @Deprecated('Use environment') Map<String, String>? env,
  3. Map<String, String>? environment,
  4. bool includeParentEnvironment = true,

Find the command according to the paths or env variables (PATH)


String? whichSync(String command,
    {@Deprecated('Use environment') Map<String, String>? env,
    Map<String, String>? environment,
    bool includeParentEnvironment = true}) {
  // only valid for single commands
  if (basename(command) != command) {
    return null;
  // Merge system environment
  var shellEnvironment = ShellEnvironment.full(
      environment: environment,
      includeParentEnvironment: includeParentEnvironment);
  return shellEnvironment.whichSync(command);