nextString method

String nextString(
  1. {int length = 16,
  2. String chars = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890'}
)

Returns a random String consisting of letters and numbers, by default the length of the string will be 16 characters.

Implementation

String nextString({
  int length = 16,
  String chars =
      'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890',
}) {
  return String.fromCharCodes(Iterable.generate(
      length, (_) => chars.codeUnitAt(nextInt(chars.length))));
}