removeWord method

void removeWord(
  1. String word
)

Removes all annotations whose misspelled word equals word.

Implementation

void removeWord(String word) {
  final wordLower = word.toLowerCase();
  for (final entry in _annotations.entries.toList()) {
    final filtered = entry.value
        .where((a) => a.misspelledWord.toLowerCase() != wordLower)
        .toList();
    if (filtered.isEmpty) {
      _annotations.remove(entry.key);
    } else {
      _annotations[entry.key] = filtered;
    }
  }
}