nextString method

String nextString(
  1. int length, {
  2. String charset = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
})

Implementation

String nextString(int length,
    {String charset =
        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"}) {
  if (charset.isEmpty) {
    throw Exception("Charset cannot be empty");
  }

  return String.fromCharCodes(Iterable.generate(
      length, (_) => charset.codeUnitAt(nextInt(charset.length))));
}