get method

void get ({bool force: false, RunOptions runOptions, String workingDirectory })

Run pub get on the current project. If force is true, this will execute even if the pubspec.lock file is up-to-date with respect to the pubspec.yaml file.

Implementation

static void get(
    {bool force: false, RunOptions runOptions, String workingDirectory}) {
  runOptions = mergeWorkingDirectory(workingDirectory, runOptions);
  final prefix = runOptions.workingDirectory == null
      ? ''
      : '${runOptions.workingDirectory}/';
  FileSet pubspec = new FileSet.fromFile(getFile('${prefix}pubspec.yaml'));
  FileSet publock = new FileSet.fromFile(getFile('${prefix}pubspec.lock'));

  if (force || !publock.upToDate(pubspec)) {
    _run('get', runOptions: runOptions);
  }
}