generateRandomStringBetweenLetters method

String generateRandomStringBetweenLetters(
  1. String startLetter,
  2. String endLetter,
  3. int length
)

Implementation

String generateRandomStringBetweenLetters(
    String startLetter, String endLetter, int length) {
  final start = startLetter.toLowerCase().codeUnitAt(0);
  final end = endLetter.toLowerCase().codeUnitAt(0);
  final range = end - start + 1;
  return String.fromCharCodes(
    List.generate(length, (_) => _random.nextInt(range) + start),
  );
}