generateRandomString static method

String generateRandomString(
  1. int length
)

Implementation

static String generateRandomString(int length) {
  final _random = Random();
  const _availableChars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
  final randomString = List.generate(length, (index) => _availableChars[_random.nextInt(_availableChars.length)]).join();

  return randomString;
}