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