getTmpFile static method

File getTmpFile(
  1. dynamic ext, {
  2. dynamic prefix = 'tmp_',
  3. dynamic postfix,
})

Get a temporary file.

This method doesn't create the file.

Implementation

static File getTmpFile(ext, {prefix: 'tmp_', postfix}) {
  postfix ??= TimeUtilities.DAYHOURMINUTE_TS_FORMATTER.format(DateTime.now());
  var fileName = prefix + postfix + '.' + ext;

  var dir = Directory.systemTemp.createTempSync();
  return File("${dir.path}/$fileName");
}