getCurrentBranch method

Branch? getCurrentBranch({
  1. dynamic onNoStateFile()? = onStateDoesntExist,
})

Gets current Branch that StateData points to currently only if exists

Implementation

Branch? getCurrentBranch({
  Function()? onNoStateFile = onStateDoesntExist,
}) {
  if (!exists) {
    onNoStateFile?.call();
    return null;
  }

  String? branch = stateInfo?.currentBranch;
  if (branch == null) return null;

  return Branch(branch, repository);
}