hasMinUppercase method

bool hasMinUppercase(
  1. String password,
  2. int uppercaseCount
)

Checks if password has at least uppercaseCount uppercase letter matches

Implementation

bool hasMinUppercase(String password, int uppercaseCount) {
  String pattern = '^(.*?[A-Z]){' + uppercaseCount.toString() + ',}';
  return password.contains(new RegExp(pattern));
}