RandomStringGenerator constructor Null safety

RandomStringGenerator(
  1. {int? fixedLength,
  2. int? minLength,
  3. int? maxLength,
  4. bool hasAlpha = true,
  5. AlphaCase alphaCase = AlphaCase.MIXED_CASE,
  6. bool hasDigits = true,
  7. bool hasSymbols = true,
  8. bool mustHaveAtLeastOneOfEach = true,
  9. List<String>? customUpperAlphabet,
  10. List<String>? customLowerAlphabet,
  11. List<String>? customDigits,
  12. List<String>? customSymbols}
)

Constructor

Note: The properties are not final. You can modify them after you initialize the object.

var generator = RandomStringGenerator(
    mustHaveAtLeastOneOfEach: true,
    hasAlpha: true,
    alphaCase: AlphaCase.UPPERCASE_ONLY,
    hasDigits: true,
    hasSymbols: true,
    length: 10,
  );
generator.generate();

generator.hasDigits = false;
generator.generate();

Implementation

RandomStringGenerator({
  this.fixedLength,
  this.minLength,
  this.maxLength,
  this.hasAlpha = true,
  this.alphaCase = AlphaCase.MIXED_CASE,
  this.hasDigits = true,
  this.hasSymbols = true,
  this.mustHaveAtLeastOneOfEach = true,
  this.customUpperAlphabet,
  this.customLowerAlphabet,
  this.customDigits,
  this.customSymbols,
});