createBackup method

Future<File> createBackup(
  1. File file
)

Creates a backup of a file. Returns the backup file.

Implementation

Future<File> createBackup(File file) async {
  if (!file.existsSync()) {
    throw FileSystemException('File not found for backup', file.path);
  }
  return await file.copy('${file.path}.bak');
}