toggleDictionaryHidden method

void toggleDictionaryHidden(
  1. Dictionary dictionary
)

Toggle a dictionary's between hidden and shown state. This will affect how a dictionary's search results are shown by default.

Implementation

void toggleDictionaryHidden(Dictionary dictionary) {
  _database.writeTxnSync(() {
    if (dictionary.isHidden(targetLanguage)) {
      dictionary.hiddenLanguages = [...dictionary.hiddenLanguages]
        ..remove(targetLanguage.languageCode);
    } else {
      dictionary.hiddenLanguages = [
        ...dictionary.hiddenLanguages,
        targetLanguage.languageCode
      ];
    }
    _database.dictionarys.putSync(dictionary);
  });
}