update method

Future update()

Implementation

Future update() async {
  Process git;

  if (!await installRepo.exists()) {
    git = await Process.start('git', [
      'clone',
      repo,
      installRepo.absolute.path,
    ]);
  } else {
    git = await Process.start(
      'git',
      [
        'pull',
        'origin',
        'master',
      ],
      workingDirectory: installRepo.absolute.path,
    );
  }

  git
    ..stdout.listen(stdout.add)
    ..stderr.listen(stderr.add);

  var code = await git.exitCode;

  if (code != 0) {
    throw 'git exited with code $code.';
  }
}