Skip to content

[Linux] "A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different logical key" error  #89982

@MatthewLM

Description

@MatthewLM

Keyboard input is broken on Linux when typing "@". This problem did not occur when using flutter 2.2.3. It was introduced upon upgrading to 2.5.0.

Steps to Reproduce

  1. Run flutter create bug.
  2. Update the files as follows: Just add a TextFormField().
  3. Type "[email protected]" into the TextFormField.

Expected results:

I expected to see "[email protected]"

Actual results:

Only "hello@" is shown and text input no longer works.

Logs
[+146188 ms] ** (bug:31682): WARNING **: 15:30:43.554: Unable to retrieve framework response: Message is not valid JSON
[   +6 ms]
           ══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
           The following assertion was thrown during a platform message callback:
           A KeyUpEvent is dispatched, but the state shows that the physical key is pressed on a different
           logical key. If this occurs in real application, please report this bug to Flutter. If this occurs
           in unit tests, please ensure that simulated events follow Flutter's event model as documented in
           `HardwareKeyboard`. This was the event: KeyUpEvent#de59f(physicalKey:
           PhysicalKeyboardKey#70034(usbHidUsage: "0x00070034", debugName: "Quote"), logicalKey:
           LogicalKeyboardKey#00027(keyId: "0x00000027", keyLabel: "'", debugName: "Quote Single"), character:
           null, timeStamp: 5:16:04.135000) and the recorded logical key LogicalKeyboardKey#00040(keyId:
           "0x00000040", keyLabel: "@", debugName: "At")
           'package:flutter/src/services/hardware_keyboard.dart':
           Failed assertion: line 444 pos 16: '_pressedKeys[event.physicalKey] == event.logicalKey'

           Either the assertion indicates an error in the framework itself, or we should provide substantially
           more information in this error message to help you determine and fix the underlying cause.
           In either case, please report this assertion by filing a bug on GitHub:
             https://github.com/flutter/flutter/issues/new?template=2_bug.md

           When the exception was thrown, this was the stack:
           #2      HardwareKeyboard._assertEventIsRegular.<anonymous closure> (package:flutter/src/services/hardware_keyboard.dart:444:16)
           #3      HardwareKeyboard._assertEventIsRegular (package:flutter/src/services/hardware_keyboard.dart:452:6)
           #4      HardwareKeyboard.handleKeyEvent (package:flutter/src/services/hardware_keyboard.dart:543:5)
           #5      KeyEventManager.handleRawKeyMessage (package:flutter/src/services/hardware_keyboard.dart:821:35)
           #6      BasicMessageChannel.setMessageHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:73:49)
           #7      BasicMessageChannel.setMessageHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:72:47)
           #8      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:379:35)
           #9      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:376:46)
           #10     _invoke2.<anonymous closure> (dart:ui/hooks.dart:205:15)
           #14     _invoke2 (dart:ui/hooks.dart:204:10)
           #15     _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42:5)
           #16     _Channel.push (dart:ui/channel_buffers.dart:132:31)
           #17     ChannelBuffers.push (dart:ui/channel_buffers.dart:329:17)
           #18     PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:544:22)
           #19     _dispatchPlatformMessage (dart:ui/hooks.dart:92:31)
           (elided 5 frames from class _AssertionError and dart:async)
           ════════════════════════════════════════════════════════════════════════════════════════════════════

Analyzing bug...
No issues found! (ran in 1.1s)

Relevant parts:

[✓] Flutter (Channel stable, 2.5.0, on Debian GNU/Linux 10 (buster) 4.19.0-17-amd64, locale en_GB.UTF-8)
    • Flutter version 2.5.0...
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4cc385b4b8 (5 days ago), 2021-09-07 23:01:49 -0700
    • Engine revision f0826da7ef
    • Dart version 2.14.0

[✓] Linux toolchain - develop for Linux desktop
    • clang version 7.0.1-8+deb10u2 (tags/RELEASE_701/final)
    • cmake version 3.13.4
    • ninja version 1.8.2
    • pkg-config version 0.29

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Debian GNU/Linux 10 (buster) 4.19.0-17-amd64
    • Chrome (web)    • chrome • web-javascript • Chromium 90.0.4430.212 built on Debian 10.9, running on Debian 10.10

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work lista: desktopRunning on desktopa: error messageError messages from the Flutter frameworka: text inputEntering text in a text field or keyboard related problemsc: regressionIt was better in the past than it is nowengineflutter/engine related. See also e: labels.found in release: 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-linuxBuilding on or for Linux specificallyr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions