isStrongPassword function

bool isStrongPassword(
  1. String str, {
  2. int minLength = 8,
  3. int minLowercase = 1,
  4. int minUppercase = 1,
  5. int minNumbers = 1,
  6. int minSymbols = 1,
})

Checks if the string is a strong password.

By default the password must be at least 8 characters long and contain at least one lowercase letter, one uppercase letter, one digit and one symbol. Each requirement is configurable.

Example:

isStrongPassword('Abcd1234!'); // true
isStrongPassword('weak'); // false
isStrongPassword('abcdefgh', minUppercase: 0, minNumbers: 0, minSymbols: 0); // true

Implementation

bool isStrongPassword(
  String str, {
  int minLength = 8,
  int minLowercase = 1,
  int minUppercase = 1,
  int minNumbers = 1,
  int minSymbols = 1,
}) => _isStrongPassword(
  str,
  minLength,
  minLowercase,
  minUppercase,
  minNumbers,
  minSymbols,
);