diff --git a/super_editor/lib/src/default_editor/spelling_and_grammar/spelling_and_grammar_styler.dart b/super_editor/lib/src/default_editor/spelling_and_grammar/spelling_and_grammar_styler.dart index 6d507b19f..103e6ad0c 100644 --- a/super_editor/lib/src/default_editor/spelling_and_grammar/spelling_and_grammar_styler.dart +++ b/super_editor/lib/src/default_editor/spelling_and_grammar/spelling_and_grammar_styler.dart @@ -120,11 +120,7 @@ class SpellingAndGrammarStyler extends SingleColumnLayoutStylePhase { // Apply it. viewModel.spellingErrorUnderlineStyle = _spellingErrorUnderlineStyle!; } - viewModel.spellingErrors - ..clear() - ..addAll([ - for (final spellingError in spellingErrors) spellingError.range, - ]); + viewModel.spellingErrors = spellingErrors.map((error) => error.range).toList(); if (_overrideSelectionColor && selectionHighlightColor != null) { viewModel.selectionColor = selectionHighlightColor!; @@ -136,11 +132,7 @@ class SpellingAndGrammarStyler extends SingleColumnLayoutStylePhase { // Apply it. viewModel.grammarErrorUnderlineStyle = _grammarErrorUnderlineStyle!; } - viewModel.grammarErrors - ..clear() - ..addAll([ - for (final grammarError in grammarErrors) grammarError.range, - ]); + viewModel.grammarErrors = grammarErrors.map((error) => error.range).toList(); return viewModel; }