backupFile function

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

Provide a very simple mechanism to backup a single file.

The backup is placed in '.bak' subdirectory under the passed pathToFile's directory.

Be cautious that you don't nest backups of the same file in your code as we always use the same backup target. Instead use withFileProtection.

We also renamed the backup to '

If a file at pathToFile doesn't exist then a BackupFileException is thrown unless you pass the ignoreMissing flag.

See:

Implementation

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