flutter - 如何为嵌套模型制作不同的表加入它们,而不是使用 sqflite 将它们展平或更改为 json 或字符串?
问题描述
所以这是我正在使用的实体。我想为翻译、问题创建单独的表。因此,当我在 Collection 表中插入数据时,它也会自动填充翻译和问题。
class Collection extends Equatable {
final String? id;
final String? workspaceCode;
final String? code;
final String? author;
final String? modifier;
final String? creationTime;
final String? modificationTime;
final String? unitCode;
final bool? shared;
final List<String>? permissions;
final int? version;
final Translations? name;
final Translations? description;
final List<Question>? question;
final String? resourceType;
const Collection({
this.id,
this.workspaceCode,
this.code,
this.author,
this.modifier,
this.creationTime,
this.modificationTime,
this.unitCode,
this.shared,
this.permissions,
this.version,
this.name,
this.description,
this.question,
this.resourceType,
});
解决方案
推荐阅读
- windows - 无法通过主机名连接到适用于 Windows 的 Docker sql
- powershell - 将 Powershell 脚本的返回值分配给 Groovy 变量
- r - 如何确定一系列 0-1 组合是随机分布的?
- html - 弃用 LoadString() 后如何加载 HTML
- bigbluebutton - 如何对客户端隐藏外部视频控件
- android - 如何在颤动中覆盖小部件功能
- firebase - 如何使用 Vue.Draggble 并对 Firebase 实时存储进行排序?
- machine-learning - 我应该训练哪个功能?回归
- loops - 负累加器时分支
- json - Laravel Eloquent 模型 JSON 输出格式