saveSqlCipher function

Future<void> saveSqlCipher(
  1. String path,
  2. SqlCipherDatabase database
)

Replaces path with the current SQLCipher image.

The whole file is written and flushed. This is not the rollback journal, and a crash during the write can leave a torn file.

Implementation

Future<void> saveSqlCipher(String path, SqlCipherDatabase database) async {
  final bytes = database.encryptedImage();
  await File(path).writeAsBytes(bytes, flush: true);
}