bool hasMinimumLowercase(String password, int lowercaseCount) { String pattern = '^(.*?[a-z]){' + lowercaseCount.toString() + ',}'; return password.contains(RegExp(pattern)); }