getAsync method
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 Future getAsync(
{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)) {
return runlib
.runAsync(sdkBin('pub'), arguments: ['get'], runOptions: runOptions)
.then((_) => null);
}
return new Future.value();
}