simpleRandomName static method

OutputPathHandler simpleRandomName({
  1. String allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_",
  2. required int len,
})

Implementation

static OutputPathHandler simpleRandomName(
    {String allowedChars =
        "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_",
    required int len}) {
  return (String inputPath, FileFormat outputType) {
    StringBuffer buffer = StringBuffer();
    for (int i = 0; i < len; i++) {
      buffer.write(allowedChars[random.nextInt(allowedChars.length)]);
    }
    return paths.join(paths.dirname(inputPath),
        "${buffer.toString()}.${outputType.validExtensions.first}");
  };
}