In my flutter application I have to download a password-protected zip folder from a remote server and import the .sqlite that is inside in my app.
I'm trying with archive library, but of course I'm open for a better solution if any.
I used the password parameter of ZipDecoder().decodeBytes() method, but it is not working for me.
//inside the `onDone()` callback of an http request
Archive archive = ZipDecoder().decodeBytes(
_myDownloadedData,
password: "mySuperSecretPsw", //here I set the archive psw
);
Uint8List fileDbBytes = Uint8List.fromList(archive.first.content);
setAsWorkingDb(fileDbBytes);
The archive.first.content from the snippet above looks still encrypted. I get the following errors:
E/SQLiteLog(12256): (26) file is encrypted or is not a database
E/DefaultDatabaseErrorHandler(12256): Corruption reported by sqlite on database: /data/user/0/my.own.package/app_flutter/working_data.db
E/DefaultDatabaseErrorHandler(12256): deleting the database file: /data/user/0/my.own.package/app_flutter/working_data.db
You can try
Archive archive = ZipDecoder().decodeBytes(
_myDownloadedData,
verify: true,
password: "mySuperSecretPsw", )
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With