Skip to content

Hot restart breaks keyboard input #87391

@Hixie

Description

@Hixie

Steps to reproduce:

  1. Create an app with a TextField.
  2. Launch the app with flutter run -d linux.
  3. Type in the text field. This works fine.
  4. Hot restart the app.
  5. Type in the text field. This fails with:
** (fwml:2822048): WARNING **: 22:35:22.785: Unable to retrieve framework response: Message is not valid JSON

══╡ 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 not pressed. 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#5dafa(physicalKey: PhysicalKeyboardKey#700e7(usbHidUsage: "0x000700e7", debugName:
"Meta Right"), logicalKey: LogicalKeyboardKey#0010e(keyId: "0x10000010e", keyLabel: "Super",
debugName: "Super"), character: null, timeStamp: 1115:12:48.298000)
'package:flutter/src/services/hardware_keyboard.dart':
Failed assertion: line 441 pos 16: '_pressedKeys.containsKey(event.physicalKey)'

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:441: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:203:15)
#14     _invoke2 (dart:ui/hooks.dart:202: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:536:22)
#19     _dispatchPlatformMessage (dart:ui/hooks.dart:90:31)
(elided 5 frames from class _AssertionError and dart:async)
════════════════════════════════════════════════════════════════════════════════════════════════════

Metadata

Metadata

Labels

P1High-priority issues at the top of the work lista: desktopRunning on desktopa: text inputEntering text in a text field or keyboard related problemsengineflutter/engine related. See also e: labels.found in release: 3.3Found to occur in 3.3found in release: 3.4Found to occur in 3.4frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-text-inputOwned by Text Input team

Type

No type

Projects

Status

Done

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions