isValidBranchName function

bool isValidBranchName(
  1. String? branchName
)

Function to validate a Branch name and takes a branchName

Implementation

bool isValidBranchName(String? branchName) {
  // Check if the branch name is null or empty
  if (branchName == null || branchName.isEmpty) {
    return false;
  }

  // branch should contain spaces
  if (branchName.contains(" ")) {
    return false;
  }

  // branch should not start with a dot
  if (branchName.startsWith(".")) {
    return false;
  }

  return true;
}