setField method
- {required AnkiMapping mapping,
- required Field field,
- required bool isCollapsed}
Updates a given mapping
to include a Field.
Implementation
void setField({
required AnkiMapping mapping,
required Field field,
required bool isCollapsed,
}) async {
if (isCollapsed) {
mapping.creatorCollapsedFieldKeys = [
...mapping.creatorCollapsedFieldKeys,
field.uniqueKey,
];
} else {
mapping.creatorFieldKeys = [
...mapping.creatorFieldKeys,
field.uniqueKey,
];
}
_database.writeTxnSync(() {
_database.ankiMappings.putSync(mapping);
});
}