restoreFile function

void restoreFile(
  1. String pathToFile, {
  2. bool ignoreMissing = false,
})

Designed to work with backupFile to restore a file from backup. The existing file is deleted and restored from the .bak/

Consider using withFileProtection for a more robust solution.

When the last .bak file is restored, the .bak directory will be deleted. If you don't restore all files (your app crashes) then a .bak directory and files may be left hanging around and you may need to manually restore these files. If the backup file doesn't exists this function throws a RestoreFileException unless you pass the ignoreMissing flag.

Implementation

void restoreFile(String pathToFile, {bool ignoreMissing = false}) =>
    // ignore: discarded_futures
    waitForEx(core.restoreFile(pathToFile, ignoreMissing: ignoreMissing));