simpleRandomName static method
OutputPathHandler
simpleRandomName({ - String allowedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_",
- 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}");
};
}