可以有人帮助我解决这个错误吗?

huangapple go评论62阅读模式
英文:

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.

huangapple
  • 本文由 发表于 2023年7月28日 03:31:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76782880.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定