Securely Backup & Restore Your Chat

Backup your chat#

Whenever you need to backup your chat messages, you can use the below method to start backup. The method will backup all the chats and writes to a file. Once backup completed you can get the backup file path from the Mirrorfly.onBackupSuccess event listeners.

ArgumentTypeDescription
enableEncryptionboolSpecifies whether the backup data should be encrypted or not.
Mirrorfly.startBackup(enableEncryption: enableEncryption);

Cancel Backup#

while the backup is running, if you want to cancel the backup you can use the below method

Mirrorfly.cancelBackup();

Note: Backup related events are observed through event listeners. check the event listeners details here.

Restore from a backup file#

Whenever you need to restore the chat messages from the backup file, you can use the below method.

ArgumentTypeDescription
backupFilePathStringbackup file path.
Mirrorfly.restoreBackup(backupPath: backupFilePath);

Cancel Restore#

while the restore backup is running, if you want to cancel the restore operation you can use the below method

Mirrorfly.cancelRestore();

Note: Depending on the chat messages size the above methods may take long time for completion.

Note: Restore related events are observed through event listeners. check the event listeners details here.

info

Cancelling restore operation will lead to partial db data, so avoid cancelling restore operation in most scenarios.