ensureMinLength method

String ensureMinLength({
  1. int minLength = 8,
})

Ensure mi lenght and generate rand chars

Implementation

String ensureMinLength({int minLength = 8}) {
  const String characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
  final Random rand = Random();
  String input = this;

  while (input.length < minLength) {
    final randomChar = characters[rand.nextInt(characters.length)];
    input += randomChar;
  }

  return input;
}