getAsync static 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}/';
final pubspec = FileSet.fromFile(getFile('${prefix}pubspec.yaml'));
final publock = FileSet.fromFile(getFile('${prefix}pubspec.lock'));
if (force || !publock.upToDate(pubspec)) {
return runlib
.runAsync(sdkBin('dart'),
arguments: ['pub', 'get'], runOptions: runOptions)
.then((_) => null);
}
return Future.value();
}