randomString function

String randomString(
  1. int minLength,
  2. int maxLength,
  3. bool lowercaseAz,
  4. bool uppercaseAz,
  5. bool digits,
)

Implementation

String randomString(
  int minLength,
  int maxLength,
  bool lowercaseAz,
  bool uppercaseAz,
  bool digits,
) {
  var chars = '';
  if (lowercaseAz) {
    chars += 'abcdefghijklmnopqrstuvwxyz';
  }
  if (uppercaseAz) {
    chars += 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  }
  if (digits) {
    chars += '0123456789';
  }
  return List.generate(randomInteger(minLength, maxLength),
      (index) => chars[_random.nextInt(chars.length)]).join();
}