generateRandomString function
Generates a random string of length length
Implementation
String generateRandomString({int length = 32, bool addSpaces = false}) {
return Iterable.generate(length, (_) {
if (addSpaces) {
return random.nextInt(10) >= 8
? ' '
: charList[random.nextInt(charList.length)];
}
return charList[random.nextInt(charList.length)];
}).join('');
}