stats method Null safety

Future<ShortStatDto> stats(
  1. String localCheckoutDirectory,
  2. String oldTag,
  3. dynamic newTag
)

git --shortstat oldTag newTag to fetch statistics related to insertions, deletions and number of changed files between two tags. In case of success will return a ShortStatDto object with the available data, whereas an invalidGitCommandResult in case of failure.

Implementation

Future<ShortStatDto> stats(
    String localCheckoutDirectory, String oldTag, newTag) async {
  String rawResult = "";

  try {
    ProcessResult processResult = await git_service.runGit(
        ['diff', '--shortstat', oldTag, newTag],
        throwOnError: false,
        echoOutput: false,
        processWorkingDir: localCheckoutDirectory);

    rawResult = processResult.stdout;
  } catch (e) {
    rawResult = invalidGitCommandResult;
  }

  return GitOutputParser.parseGitShortStatStdout(rawResult);
}