Skip to content

Attempted to send a key down event when no keys are in keysPressed. #125672

@alanmv01

Description

@alanmv01

Is there an existing issue for this?

Steps to reproduce

  1. Create a flutter project
    flutter create key_press_error_demo
  2. cd into project and run in Chrome
cd key_press_error_demo
flutter run -d Chrome
  1. Press the Windows key (sometimes called Meta or Super)

Expected results

Nothing special should happen.

Actual results

══╡ EXCEPTION CAUGHT BY SERVICES LIBRARY ╞══════════════════════════════════════════════════════════
The following assertion was thrown during a platform message callback:
Assertion failed:
file:///home/alan/Programs/flutter/packages/flutter/lib/src/services/raw_keyboard.dart:683:7
event is! RawKeyDownEvent || _keysPressed.isNotEmpty
"Attempted to send a key down event when no keys are in keysPressed. This state can occur if the key
event being sent doesn't properly set its modifier flags. This was the event:
RawKeyDownEvent#499d8(logicalKey: LogicalKeyboardKey#4b191(keyId: "0x200000106", keyLabel: "Meta
Left", debugName: "Meta Left"), physicalKey: PhysicalKeyboardKey#700e3(usbHidUsage:
"0x000700e3", debugName: "Meta Left"), repeat: false) and its data:
RawKeyEventDataWeb#5923c(code: MetaLeft, key: Meta, location: 1, metaState: 0, keyCode: 91)"

When the exception was thrown, this was the stack:
dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49 throw
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 29:3 assertFailed
packages/flutter/src/services/raw_keyboard.dart 683:49 handleRawKeyEvent
packages/flutter/src/services/hardware_keyboard.dart 951:30 handleRawKeyMessage
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/flutter/src/services/hardware_keyboard.dart 923:51 handleRawKeyMessage
packages/flutter/src/services/platform_channel.dart 214:49
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/flutter/src/services/platform_channel.dart 213:58
packages/flutter/src/services/binding.dart 393:35
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 84:54 runBody
dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 123:5 _async
packages/flutter/src/services/binding.dart 390:98
lib/_engine/engine/platform_dispatcher.dart 1199:13 invoke2
lib/ui/channel_buffers.dart 25:12 invoke
lib/ui/channel_buffers.dart 65:7 push
lib/ui/channel_buffers.dart 131:16 push
lib/_engine/engine/platform_dispatcher.dart 378:25 invokeOnPlatformMessage
lib/_engine/engine/raw_keyboard.dart 142:39 [_handleHtmlEvent]
lib/_engine/engine/raw_keyboard.dart 12:7
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 367:37 _checkAndCall
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/operations.dart 372:39 dcall
════════════════════════════════════════════════════════════════════════════════════════════════════

Code sample

Code sample
// The default code created by `flutter create` suffices to reproduce the error.

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.7.12, on Debian GNU/Linux 12 (bookworm) 6.1.0-7-amd64, locale en_IN)
    • Flutter version 3.7.12 on channel stable at /home/alan/Programs/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (10 days ago), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /home/alan/Programs/Android/Sdk/
    • Platform android-33, build-tools 30.0.3
    • Java binary at: /home/alan/Programs/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • CHROME_EXECUTABLE = /usr/bin/chromium

[✓] Linux toolchain - develop for Linux desktop
    • Debian clang version 14.0.6
    • cmake version 3.25.1
    • ninja version 1.11.1
    • pkg-config version 1.8.1

[✓] Android Studio (version 2022.2)
    • Android Studio at /home/alan/Programs/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Community Edition (version 2022.1)
    • IntelliJ at /home/alan/Programs/idea
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Debian GNU/Linux 12 (bookworm) 6.1.0-7-amd64
    • Chrome (web)    • chrome • web-javascript • Chromium 112.0.5615.138 built on Debian 12.0, running on Debian 12.0

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!

Metadata

Metadata

Assignees

Labels

c: crashStack traces logged to the consoleengineflutter/engine related. See also e: labels.found in release: 3.10Found to occur in 3.10found in release: 3.7Found to occur in 3.7has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer version

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions