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 = File(generatedFilePath);
  final fileCopy = File('$targetDirectory/$targetName.pdf');
  fileCopy.writeAsBytesSync(File.fromUri(fileOriginal.uri).readAsBytesSync());
  fileOriginal.delete();
  return fileCopy;
}