Generate Random String in Dart

import 'dart:math';

void main() {
  print(generateRandomString(3));
  print(generateRandomString(10));
  print(generateRandomString(20));
}

String generateRandomString(int len) {
  var r = Random();
  const chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890';
  return List.generate(len, (index) => chars[r.nextInt(chars.length)]).join();
}   
  
ItZ
t25KzQY3xY
KG3t2nHgOANrdhyxMInT