password static method

String password({
  1. int length = 12,
  2. bool lowercase = true,
  3. bool uppercase = true,
  4. bool digits = true,
  5. bool symbols = true,
})

Cryptographically secure random password with configurable character sets.

Uses Random.secure; not affected by Rand.useRng or Rand.seed.

Minimum length is 4. At least one of lowercase, uppercase, digits, or symbols must remain true.

Rand.password();                  // 12-char mixed-charset
Rand.password(length: 20);
Rand.password(symbols: false);    // no symbols
Rand.password(uppercase: false, digits: false, symbols: false); // lowercase only

Throws ArgumentError when length < 4 or all character sets are disabled.

Not for production secrets — see SECURITY.md for the package's stability contract.

Implementation

static String password({
  int length = 12,
  bool lowercase = true,
  bool uppercase = true,
  bool digits = true,
  bool symbols = true,
}) =>
    _i.password(
      length: length,
      lowercase: lowercase,
      uppercase: uppercase,
      digits: digits,
      symbols: symbols,
    );