I have set up a data storage system with Hive in my Flutter application. After installing everything, I get this error:
我已经在我的颤动应用程序中设置了一个带有蜂窝的数据存储系统。安装完所有内容后,我收到以下错误:
FileSystemException (FileSystemException: Cannot create file, path = './skipwelcomedata_bad_keys.hive' (OS Error: Read-only file system, errno = 30))
What is this error? How can I solve it? Thanks for helps.
这是什么错误?我怎么才能解决它呢?谢谢你的帮助。
更多回答
优秀答案推荐
final directory = await getApplicationDocumentsDirectory();
print("${directory.path}/db");
// Hive.init(directory.path);
collection ??= await BoxCollection.open(
'AppName', // Name of your database
{'images'}, // Names of your boxes
path: "${directory.path}/db", // <-- this fixes it
);
I noticed a bug, if you just put the documents directory it doesn't work because it won't add a slash to the end of the path. So you have to add something like /db after the slash. I don't if I was having a weird problem, but seemed to be the issue.
我注意到一个错误,如果你只是把文档目录放进去,它不会起作用,因为它不会在路径的末尾添加斜杠。因此,您必须在斜杠后面添加类似/db的内容。我不知道我是否有一个奇怪的问题,但似乎是问题所在。
更多回答
我是一名优秀的程序员,十分优秀!