which 0.1.3

  • README.md
  • Installing
  • Versions
  • 2

which pub package Build Status Coverage Status

Check for and locate installed executables. Just like unix which(1), except:

  • Doesn't shell out (fast).
  • Cross-platform (works on windows).


pub global activate den
den install which


import 'dart:io';

import 'package:which/which.dart';

main(arguments) async {

  // Asynchronously
  var git = await which('git', orElse: () => null);

  // Or synchronously
  var git = whichSync('git', orElse: () => null);

  if (git == null) {
    print('Please install git and try again');

  await Process.run(git, ['add', '-A']);
  await Process.run(git, ['commit', '-m', arguments.first]);


  • Assume owner/group matches that of executable until it's possible to check. (#5)

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  which: ^0.1.3

2. Install it

You can install packages from the command line:

with pub:

$ pub get

Alternatively, your editor might support pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:which/which.dart';
Version Uploaded Documentation Archive
0.1.3 Feb 12, 2015 Go to the documentation of which 0.1.3 Download which 0.1.3 archive
0.1.2 Jan 15, 2015 Go to the documentation of which 0.1.2 Download which 0.1.2 archive
0.1.1 Jan 14, 2015 Go to the documentation of which 0.1.1 Download which 0.1.1 archive
0.1.0 Jan 13, 2015 Go to the documentation of which 0.1.0 Download which 0.1.0 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

The package version is not analyzed, because it does not support Dart 2. Until this is resolved, the package will receive a health and maintenance score of 0.

Analysis issues and suggestions

Fix dependencies in pubspec.yaml.

Running pub upgrade failed with the following output:

ERR: The current Dart SDK version is 2.1.0.
 Because which depends on when >=0.2.0 which requires SDK version <2.0.0, version solving failed.

Health suggestions

Format lib/src/candidate_paths.dart.

Run dartfmt to format lib/src/candidate_paths.dart.

Format lib/src/has_permission.dart.

Run dartfmt to format lib/src/has_permission.dart.

Format lib/src/is_executable.dart.

Run dartfmt to format lib/src/is_executable.dart.

Fix additional 3 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/src/util.dart (Run dartfmt to format lib/src/util.dart.)
  • lib/src/which_impl.dart (Run dartfmt to format lib/src/which_impl.dart.)
  • lib/which.dart (Run dartfmt to format lib/which.dart.)

Maintenance issues and suggestions

Add SDK constraint in pubspec.yaml. (-50 points)

For information about setting SDK constraint, please see https://www.dartlang.org/tools/pub/pubspec#sdk-constraints.

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Fix dependencies in pubspec.yaml.

Running dartdoc failed. (-10 points)

Make sure dartdoc runs without any issues.

Package is too old. (-100 points)

The package was released more than two years ago.

Homepage URL does not exists. (-20 points)

We were unable to access https://github.com/seaneagan/which.dart at the time of the analysis.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use which.dart.