randomString static method
Implementation
static String randomString({int? length}) {
const randomChars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
const charsLength = randomChars.length;
final rand = Random();
final codeUnits = List.generate(
length ?? 10,
(index) {
final n = rand.nextInt(charsLength);
return randomChars.codeUnitAt(n);
},
);
return String.fromCharCodes(codeUnits);
}