alphaNumeric static method

String alphaNumeric(
  1. int length, {
  2. bool includeUppercase = false,
})

Implementation

static String alphaNumeric(int length, {bool includeUppercase = false}) {
  const lowercase = 'abcdefghijklmnopqrstuvwxyz';
  const uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
  const numbers = '0123456789';
  final chars = includeUppercase ? (lowercase + uppercase + numbers) : (lowercase + numbers);
  final rand = math.Random();
  return List.generate(length, (_) => chars[rand.nextInt(chars.length)]).join('');
}