setFieldEnhancement method

void setFieldEnhancement(
  1. {required AnkiMapping mapping,
  2. required Field field,
  3. required int slotNumber,
  4. required Enhancement enhancement}
)

Updates a given mapping's persisted enhancement for a given field and slotNumber.

Implementation

void setFieldEnhancement({
  required AnkiMapping mapping,
  required Field field,
  required int slotNumber,
  required Enhancement enhancement,
}) async {
  mapping.enhancements![field.uniqueKey] ??= {};
  mapping.enhancements![field.uniqueKey]![slotNumber] = enhancement.uniqueKey;

  _database.writeTxnSync(() {
    _database.ankiMappings.putSync(mapping);
  });
}