generateRandomString method
Generates a random alphanumeric string of a specified length.
length
- The length of the random string. Defaults to 8.
Returns a String containing the randomly generated string.
Implementation
String generateRandomString([int length = 8]) {
final random = Random();
const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
final charList =
List.generate(length, (index) => chars[random.nextInt(chars.length)]);
return charList.join('');
}