getDependencies method

Future<ProcessResult> getDependencies({
  1. bool offline = true,
})

Implementation

Future<ProcessResult> getDependencies({bool offline = true}) async {
  final args = ["pub", "get"];
  if (offline) {
    args.add("--offline");
  }

  const cmd = "dart";
  final result = await Process.run(
    cmd,
    args,
    workingDirectory: workingDirectory.absolute.path,
    runInShell: true,
  ).timeout(const Duration(seconds: 45));

  if (result.exitCode != 0) {
    throw Exception("${result.stderr}");
  }

  return result;
}