randomString function

String randomString (
  1. int length,
  2. {int from: asciiStart,
  3. int to: asciiEnd,
  4. AbstractRandomProvider provider: const DefaultRandomProvider()}
)

Generates a random string of length with characters between ascii from to to. Defaults to characters of ascii '!' to '~'.

Implementation

String randomString(int length,
    {int from = asciiStart,
    int to = asciiEnd,
    AbstractRandomProvider provider = const DefaultRandomProvider()}) {
  return String.fromCharCodes(List.generate(
      length, (index) => randomBetween(from, to, provider: provider)));
}