randomString function
Returns a random String with a set length.
Is cryptographically insecure by default. Set secure to true to utilize
Random.secure. You may provide a pool of characters to pick from.
Implementation
String randomString(int length,
{bool secure = false,
String pool =
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'}) {
final random = secure ? Random.secure() : _random;
return List.generate(length, (i) => pool[random.nextInt(pool.length)]).join();
}