getDependencies method

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

Implementation

Future<ProcessResult> getDependencies({bool offline = true}) async {
  var args = ['get'];
  if (offline) {
    args.add('--offline');
  }

  final cmd = Platform.isWindows ? 'pub.bat' : 'pub';
  var 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;
}