updateDictionaryHistoryHelper function

Future<void> updateDictionaryHistoryHelper(
  1. UpdateDictionaryHistoryParams params
)

Add a DictionarySearchResult to the dictionary history. If the maximum value is exceed, the dictionary history is cut down to the newest values.

Implementation

Future<void> updateDictionaryHistoryHelper(
  UpdateDictionaryHistoryParams params,
) async {
  final Isar database = await Isar.open(
    globalSchemas,
    directory: params.directoryPath,
    maxSizeMiB: 8192,
  );

  DictionarySearchResult result =
      database.dictionarySearchResults.getSync(params.resultId)!;

  database.writeTxnSync(() {
    result.scrollPosition = params.newPosition;
    database.dictionarySearchResults.putSync(result);
  });
}