Skip to content

Commit 3f504da

Browse files
[SuperEditor] - Fix immutability violation in spellchecking styler (Resolves #2560) (#2568)
1 parent 139580e commit 3f504da

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

super_editor/lib/src/default_editor/spelling_and_grammar/spelling_and_grammar_styler.dart

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,7 @@ class SpellingAndGrammarStyler extends SingleColumnLayoutStylePhase {
120120
// Apply it.
121121
viewModel.spellingErrorUnderlineStyle = _spellingErrorUnderlineStyle!;
122122
}
123-
viewModel.spellingErrors
124-
..clear()
125-
..addAll([
126-
for (final spellingError in spellingErrors) spellingError.range,
127-
]);
123+
viewModel.spellingErrors = spellingErrors.map((error) => error.range).toList();
128124

129125
if (_overrideSelectionColor && selectionHighlightColor != null) {
130126
viewModel.selectionColor = selectionHighlightColor!;
@@ -136,11 +132,7 @@ class SpellingAndGrammarStyler extends SingleColumnLayoutStylePhase {
136132
// Apply it.
137133
viewModel.grammarErrorUnderlineStyle = _grammarErrorUnderlineStyle!;
138134
}
139-
viewModel.grammarErrors
140-
..clear()
141-
..addAll([
142-
for (final grammarError in grammarErrors) grammarError.range,
143-
]);
135+
viewModel.grammarErrors = grammarErrors.map((error) => error.range).toList();
144136

145137
return viewModel;
146138
}

0 commit comments

Comments
 (0)