flutter 存档 : unzip password-protected folder

标签 flutter dart io

在我的 flutter 应用程序中,我必须从远程服务器下载一个受密码保护的 zip 文件夹,然后导入我的应用程序中的 .sqlite

我正在尝试 archive图书馆,但我当然愿意寻求更好的解决方案。

我使用了 ZipDecoder().decodeBytes() 方法的 password 参数,但它对我不起作用。

//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);

上面代码段中的 archive.first.content 看起来仍然是加密的。我收到以下错误:

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

最佳答案

你可以试试

Archive archive = ZipDecoder().decodeBytes(
   _myDownloadedData,
   verify: true,
   password: "mySuperSecretPsw", )

关于 flutter 存档 : unzip password-protected folder,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57107887/

相关文章:

flutter : How to change format dateTime with mounth in String?

IOS Bug,键盘不显示

dart - 列出与为 linter 中的规则分配真实值之间的区别

python - 性能:使用 Python 读取文件的最快方法

flutter - 应用退出时无法调用 dispose() 方法

android - 升级到最新的 SDK 版本 1.20.4 后运行/调试 Flutter 应用程序非常慢

dart - mod_dart 已经死了 - 帮我重建它

python - 使用 np.fromfile 或 open & struct 读取 fortran 二进制文件(流式访问)

java - 在 Java 程序之间共享 I/O

flutter - 如何使用整洁的架构和 bloc 库 flutter 来实现 WebSocket?