英文:
May someone please assist me with this error?
问题
我正在尝试使用Objectbox作为数据库,在Flutter中创建一个基本的待办事项应用程序。
这是错误信息:
[错误:flutter/runtime/dart_vm_initializer.cc(41)]
未处理异常:ObjectBoxException:创建存储失败:
传入的实体ID 1:2836062220106497081与现有的UID 524091579686138896不匹配
英文:
I am trying to create a basic todo app in flutter using Objectbox as a database.
This is the error:
> [ERROR:flutter/runtime/dart_vm_initializer.cc(41)]
> Unhandled Exception: ObjectBoxException: failed to create store:
> Incoming entity ID 1:2836062220106497081 does not match existing UID 524091579686138896
答案1
得分: 1
从ObjectBox的故障排除指南中:
> 这意味着您的代码中定义的数据模型(使用@Entity类)与现有数据库文件的数据模型存在冲突。
在元模型文档中提到:
> 基本上有两种解决方法:
> - 解决或重建default.json元模型文件,以使其与现有数据库文件的模型匹配。
> - 保留或创建一个新的default.json模型文件,并删除数据库文件。但是,这将丢失所有现有数据。
英文:
From the ObjectBox's troubleshooting guide:
> This means there is a conflict between the data model defined in your code (using @Entity classes) and the data model of the existing database file.
In the meta models docs it says:
> There are basically two ways to resolve this:
> - Resolve conflicts in or reconstruct the default.json meta model file to match the model of an existing database file.
> - Keep or create a fresh default.json model file and delete the database file. However, this will lose all existing data.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论