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