copyWith method

SpellCheckConfiguration copyWith({
  1. SpellCheckService? spellCheckService,
  2. Color? misspelledSelectionColor,
  3. TextStyle? misspelledTextStyle,
  4. EditableTextContextMenuBuilder? spellCheckSuggestionsToolbarBuilder,
})

Returns a copy of the current SpellCheckConfiguration instance with specified overrides.

Implementation

SpellCheckConfiguration copyWith({
  SpellCheckService? spellCheckService,
  Color? misspelledSelectionColor,
  TextStyle? misspelledTextStyle,
  EditableTextContextMenuBuilder? spellCheckSuggestionsToolbarBuilder}) {
  if (!_spellCheckEnabled) {
    // A new configuration should be constructed to enable spell check.
    return const SpellCheckConfiguration.disabled();
  }

  return SpellCheckConfiguration(
    spellCheckService: spellCheckService ?? this.spellCheckService,
    misspelledSelectionColor: misspelledSelectionColor ?? this.misspelledSelectionColor,
    misspelledTextStyle: misspelledTextStyle ?? this.misspelledTextStyle,
    spellCheckSuggestionsToolbarBuilder : spellCheckSuggestionsToolbarBuilder ?? this.spellCheckSuggestionsToolbarBuilder,
  );
}