hasMinimumUppercase static method

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

Checks if the password has a minimum number of uppercase characters.

Returns true if the password contains at least uppercaseCount uppercase characters, otherwise returns false.

Implementation

static bool hasMinimumUppercase(String password, int uppercaseCount) {
  String pattern = '^(.*?[A-Z]){$uppercaseCount,}';
  return password.contains(RegExp(pattern));
}