Future<ProcessResult> runPubGet(Directory workingDirectory, { bool offline: false })

Source

Future<ProcessResult> runPubGet(Directory workingDirectory,
    {bool offline: false}) async {
  var args = ["get", "--no-packages-dir"];
  if (offline) {
    args.add("--offline");
  }

  try {
    var result = await Process
        .run("pub", args,
            workingDirectory: workingDirectory.absolute.path,
            runInShell: true)
        .timeout(new Duration(seconds: 20));

    if (result.exitCode != 0) {
      throw new CLIException(
          "${result.stderr}\n\nIf you are offline, try using --offline.");
    }

    return result;
  } on TimeoutException {
    displayError(
        "Timed out fetching dependencies. Reconnect to the internet or use --offline.");
    rethrow;
  }
}