getRandomString static method

String getRandomString(
  1. int length
)

Implementation

static String getRandomString(final int length) {
  const _chars =
      'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
  final Random _rnd = Random.secure();
  return String.fromCharCodes(
    Iterable.generate(
        length, (_) => _chars.codeUnitAt(_rnd.nextInt(_chars.length))),
  );
}