randomString static method
Generates a random string of specified length
Example:
Helpers.randomString(10); // Random 10-character string
Implementation
static String randomString(
int length, {
String chars =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
}) {
final random = Random();
return String.fromCharCodes(
Iterable.generate(
length,
(_) => chars.codeUnitAt(random.nextInt(chars.length)),
),
);
}