randomStr function

String randomStr(
  1. {int length = 10}
)

Implementation

String randomStr({int length = 10}){
  String alphabet = 'qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM';
  String left = '';
  for (var i = 0; i < length; i++) {
    left = left + alphabet[Random().nextInt(alphabet.length)];
  }
  return left;
}