generateRandomStringWithNumbers method
Implementation
String generateRandomStringWithNumbers(int length) {
String chars =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
return String.fromCharCodes(
List.generate(length, (_) {
if (_random.nextBool()) {
return _random.nextInt(10) + 48; // numbers 0-9
} else {
return chars
.codeUnitAt(_random.nextInt(chars.length - 10) + 10); // letters
}
}),
);
}