setAutoFieldEnhancement method

void setAutoFieldEnhancement(
  1. {required AnkiMapping mapping,
  2. required Field field,
  3. required Enhancement enhancement}
)

Updates a given mapping's persisted auto enhancement for a given field.

Implementation

void setAutoFieldEnhancement({
  required AnkiMapping mapping,
  required Field field,
  required Enhancement enhancement,
}) async {
  /// -1 is reserved for the auto enhancement.
  mapping.enhancements![field.uniqueKey]![AnkiMapping.autoModeSlotNumber] =
      enhancement.uniqueKey;

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