首页 > 解决方案 > 如何为嵌套模型制作不同的表加入它们,而不是使用 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,

});

标签: fluttersqflite

解决方案


推荐阅读