deleteDictionary method

Future<void> deleteDictionary(
  1. Dictionary dictionary
)

Delete all dictionary data from the database.

Implementation

Future<void> deleteDictionary(Dictionary dictionary) async {
  /// New results may be wrong after dictionary is added so this has to be
  /// done.
  clearDictionaryResultsCache();

  ReceivePort receivePort = ReceivePort();
  DeleteDictionaryParams params = DeleteDictionaryParams(
    dictionaryId: dictionary.id,
    directoryPath: _databaseDirectory.path,
    sendPort: receivePort.sendPort,
  );

  await compute(deleteDictionaryHelper, params);
  await _dictionaryHistory.clear();

  dictionarySearchAgainNotifier.notifyListeners();
}