getRandomString function

String getRandomString([
  1. int length = 10
])

Implementation

String getRandomString([int length = 10]) {
  const charSet =
      'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
  return String.fromCharCodes(Iterable.generate(
      length, (_) => charSet.codeUnitAt(_random.nextInt(charSet.length))));
}