randomAlphaNumeric static method
Generates a random alpha-numeric string of the specified length
.
Implementation
static String randomAlphaNumeric(int length) {
const chars =
'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
Random rnd = Random();
return String.fromCharCodes(Iterable.generate(
length, (_) => chars.codeUnitAt(rnd.nextInt(chars.length))));
}