copyAndDeleteOriginalFile static method

File copyAndDeleteOriginalFile(
  1. String generatedFilePath,
  2. String targetDirectory,
  3. String targetName
)

Implementation

static File copyAndDeleteOriginalFile(String generatedFilePath, String targetDirectory, String targetName) {
  final fileOriginal = new File(generatedFilePath);
  final fileCopy = new File('$targetDirectory/$targetName.pdf');
  fileCopy.writeAsBytesSync(File.fromUri(fileOriginal.uri).readAsBytesSync());
  fileOriginal.delete();
  return fileCopy;
}