Skip to content

SpellCheckConfiguration == and hashCode ignore misspelledSelectionColor #195403

Description

@ChandraChaan

Steps to reproduce

const red = SpellCheckConfiguration(misspelledSelectionColor: Color(0xFFFF0000));
const blue = SpellCheckConfiguration(misspelledSelectionColor: Color(0xFF0000FF));
print(red == blue); // true

Then rebuild an EditableText whose spellCheckConfiguration differs only in misspelledSelectionColor (same service and text style).

Expected results

red == blue is false, and EditableText uses the new misspelledSelectionColor.

Actual results

SpellCheckConfiguration.operator == and hashCode don't include misspelledSelectionColor (added in #125162), so the two configurations compare equal. EditableTextState.didUpdateWidget only re-infers _spellCheckConfiguration when oldWidget.spellCheckConfiguration != widget.spellCheckConfiguration, so it keeps using the old selection color for misspelled words.

Flutter version

master and stable 3.47.8.

Activity

  1. saurabh-mirajkar commented on Oct 27, 2026

    @saurabh-mirajkar
    Contributor

    @ChandraChaan Thanks for the report. Could you share a minimal code sample or widget test that reproduces the issue, the complete steps to reproduce it, and the output of flutter doctor -v for both stable and master channels?

  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    and removed
    in triagePresently being triaged by the triage team
    on Oct 27, 2026
  3. ChandraChaan commented on Oct 27, 2026

    @ChandraChaan
    Author

    Thanks! Steps: flutter create --empty repro, save this as test/repro_test.dart, run flutter test.

    Widget test
    import 'package:flutter/services.dart';
    import 'package:flutter/widgets.dart';
    import 'package:flutter_test/flutter_test.dart';
    
    void main() {
      test('configs that differ only in misspelledSelectionColor are not equal', () {
        const red = SpellCheckConfiguration(misspelledSelectionColor: Color(0xFFFF0000));
        const blue = SpellCheckConfiguration(misspelledSelectionColor: Color(0xFF0000FF));
    
        expect(red == blue, isFalse);
      });
    
      testWidgets('EditableText uses the new misspelledSelectionColor after a rebuild', (
        WidgetTester tester,
      ) async {
        final controller = TextEditingController(text: 'Helo wrld');
        addTearDown(controller.dispose);
        final focusNode = FocusNode();
        addTearDown(focusNode.dispose);
        final spellCheckService = DefaultSpellCheckService();
    
        Widget build(Color misspelledSelectionColor) {
          return Directionality(
            textDirection: TextDirection.ltr,
            child: MediaQuery(
              data: const MediaQueryData(),
              child: EditableText(
                controller: controller,
                focusNode: focusNode,
                style: const TextStyle(),
                cursorColor: const Color(0xFF000000),
                backgroundCursorColor: const Color(0xFF808080),
                spellCheckConfiguration: SpellCheckConfiguration(
                  spellCheckService: spellCheckService,
                  misspelledTextStyle: const TextStyle(
                    decoration: TextDecoration.underline,
                    decorationColor: Color(0xFFFF0000),
                  ),
                  misspelledSelectionColor: misspelledSelectionColor,
                ),
              ),
            ),
          );
        }
    
        await tester.pumpWidget(build(const Color(0xFFFF0000)));
        await tester.pumpWidget(build(const Color(0xFF0000FF)));
    
        final EditableTextState state = tester.state<EditableTextState>(find.byType(EditableText));
        expect(state.spellCheckConfiguration.misspelledSelectionColor, const Color(0xFF0000FF));
      });
    }

    Expected: both tests pass.

    Actual: both fail on stable 3.47.8 and on master (7ebd815). red == blue is true, and EditableText keeps the old red colour after the rebuild. Both pass with #195404.

    flutter doctor -v (stable; SDK path and PATH warnings removed, the SDKs were separate checkouts)
    [!] Flutter (Channel stable, 3.47.8, on macOS 27.0.1 26A434 darwin-arm64, locale en-IN) [3.8s]
        • Flutter version 3.47.8 on channel stable at <stable SDK path>
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 737ba8f885 (4 days ago), 2026-10-22 21:37:31 -0700
        • Engine revision cf636b1dfb
        • Dart version 3.13.7
        • DevTools version 2.60.0
        • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [5.9s]
        • Android SDK at /Users/chandra/Library/Android/sdk
        • Emulator version 36.3.10.0 (build_id 14472402) (CL:N/A)
        • Platform android-37.0, build-tools 36.1.0
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
          This is the JDK bundled with the latest Android Studio installation on this machine.
          To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 21.0.8+-14196175-b1038.72)
        • All Android licenses accepted.
    
    [!] Xcode - develop for iOS and macOS (Xcode 27.1) [6.0s]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 27A9275
        ! iOS 27.1 Simulator not installed; this may be necessary for iOS and macOS development.
          To download and install the platform, open Xcode, select Xcode > Settings > Components,
          and click the GET button for the required platform.
    
          For more information, please visit:
            https://developer.apple.com/documentation/xcode/installing-additional-simulator-runtimes
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [8ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Connected device (2 available) [13.6s]
        • macOS (desktop) • macos  • darwin-arm64   • macOS 27.0.1 26A434 darwin-arm64
        • Chrome (web)    • chrome • web-javascript • Google Chrome 156.0.8078.48
    
    [✓] Network resources [1,009ms]
        • All expected network resources are available.
    
    ! Doctor found issues in 2 categories.
    
    flutter doctor -v (master; SDK path and PATH warnings removed)
    [!] Flutter (Channel master, 3.50.0-0.2.pre, on macOS 27.0.1 26A434 darwin-arm64, locale en-IN) [2.3s]
        • Flutter version 3.50.0-0.2.pre on channel master at <master SDK path>
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 7ebd8154ad (6 hours ago), 2026-10-27 07:39:25 +0000
        • Engine revision 7ebd8154ad
        • Dart version 3.15.0 (build 3.15.0-81.0.dev)
        • DevTools version 2.61.0
        • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, enable-record-use, enable-swift-package-manager, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration, enable-riscv64, enable-hcpp
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [1,508ms]
        • Android SDK at /Users/chandra/Library/Android/sdk
        • Emulator version 36.3.10.0 (build_id 14472402) (CL:N/A)
        • Platform android-37.0, build-tools 36.1.0
        • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
          This is the JDK bundled with the latest Android Studio installation on this machine.
          To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
        • Java version OpenJDK Runtime Environment (build 21.0.8+-14196175-b1038.72)
        • All Android licenses accepted.
    
    [!] Xcode - develop for iOS and macOS (Xcode 27.1) [1,120ms]
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Build 27A9275
        ! iOS 27.1 Simulator not installed; this may be necessary for iOS and macOS development.
          To download and install the platform, open Xcode, select Xcode > Settings > Components,
          and click the GET button for the required platform.
    
          For more information, please visit:
            https://developer.apple.com/documentation/xcode/installing-additional-simulator-runtimes
        • CocoaPods version 1.16.2
    
    [✓] Chrome - develop for the web [5ms]
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Connected device (2 available) [7.4s]
        • macOS (desktop) • macos  • darwin-arm64   • macOS 27.0.1 26A434 darwin-arm64
        • Chrome (web)    • chrome • web-javascript • Google Chrome 156.0.8078.48
    
    [✓] Network resources [866ms]
        • All expected network resources are available.
    
    ! Doctor found issues in 2 categories.
    
  4. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Oct 27, 2026
  5. added
    a: text inputEntering text in a text field or keyboard related problems
    frameworkflutter/packages/flutter repository. See also f: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    on Oct 27, 2026
  6. added
    P2Important issues not at the top of the work list
    on Oct 29, 2026
  7. Renzo-Olivares commented on Oct 29, 2026

    @Renzo-Olivares
    Contributor

    Thanks for the report @ChandraChaan, this seems like a valid issue and we would definitely welcome a PR for it.

  8. ChandraChaan commented on Oct 29, 2026

    @ChandraChaan
    Author

    Thanks @Renzo-Olivares! The PR is already up: #195404 adds misspelledSelectionColor to == and hashCode, with a unit test for the equality and a widget test that rebuilds EditableText with a new color (both tests from the repro above). It's ready for review whenever you or someone on text input has a moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: text inputEntering text in a text field or keyboard related problemsframeworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-text-inputOwned by Text Input teamtriaged-text-inputTriaged by Text Input team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions