randomId function
Generates a random alpha-numeric ascii encoded value of
the specified length
(defaults to 12
).
Implementation
String randomId([int length = 12]) {
final max = _asciiChars.length - 1;
return ascii.decode(List.generate(
length,
(index) => _asciiChars[randomInt(0, max)],
));
}