alphaNumeric static method
String
alphaNumeric(
- int length, {
- 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('');
}