Closed chifandeyu closed 2 years ago
Hi @chifandeyu, thanks for filing the issue, I am unable to reproduce the exception on entering @ symbol in textfield using left shift, when targeting windows Desktop. Is the keyboard input source set to Chinese? And Are you using a qwerty keyboard or some other keyboard?
Looks like a duplicate of https://github.com/flutter/flutter/issues/91203 (closed)
Running "flutter pub get" in keyboardissue...
Launching lib\main.dart on Windows in debug mode...
Connecting to VM Service at ws://127.0.0.1:59465/vIJZOdkjIlU=/ws
Lost connection to device.
Exited (sigterm)
Hi @chifandeyu, thanks for filing the issue, I am unable to reproduce the exception on entering @ symbol in textfield using left shift, when targeting windows Desktop. Is the keyboard input source set to Chinese? And Are you using a qwerty keyboard or some other keyboard?
Looks like a duplicate of #91203 (closed)
code sample
import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; void main() { runApp(const App()); } class App extends StatelessWidget { const App({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, ), home: const Screen(), ); } } class Screen extends StatelessWidget { const Screen({ Key? key, }) : super(key: key); @override Widget build(BuildContext context) { return const Scaffold(body: Center(child: TextField())); } }
Running "flutter pub get" in keyboardissue... Launching lib\main.dart on Windows in debug mode... Connecting to VM Service at ws://127.0.0.1:59465/vIJZOdkjIlU=/ws Lost connection to device. Exited (sigterm)
flutter doctor -v (windows)
[√] Flutter (Channel stable, 3.0.0, on Microsoft Windows [Version 10.0.19044.1645], locale en-IN) • Flutter version 3.0.0 at C:\flutter_sdk\stable • Upstream repository https://github.com/flutter/flutter.git • Framework revision ee4e09cce0 (6 days ago), 2022-05-09 16:45:18 -0700 • Engine revision d1b9a6938a • Dart version 2.17.0 • DevTools version 2.12.2 [√] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at C:\Users\mahesh\AppData\Local\Android\sdk • Platform android-31, build-tools 31.0.0 • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 11.0.11+9-b60-7590822) • All Android licenses accepted. [√] Chrome - develop for the web • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe [√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.4) • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community • Visual Studio Community 2019 version 16.11.31727.386 • Windows 10 SDK version 10.0.19041.0 [√] Android Studio (version 2021.1) • Android Studio at C:\Program Files\Android\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 11.0.11+9-b60-7590822) [√] VS Code (version 1.64.2) • VS Code at C:\Users\mahesh\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.40.0 [√] Connected device (3 available) • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1645] • Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.54 • Edge (web) • edge • web-javascript • Microsoft Edge 100.0.1185.50 [√] HTTP Host Availability • All required HTTP hosts are available • No issues found!
Yes, I am using the Microsoft Pinyin input method ("微软拼音"). It is an american standard keyboard. And keyboard is the computer's own, not an external keyboard.
Thanks for the info, I am unable to reproduce the issue on a standard qwerty keyboard on stable 3. Labeling the issue for further investigation from the team.
cc: @dkwingsmt
The debug log may be helpful. My computer is ThinkPad x250. I'm not sure whether the problem is related to the computer model. error.txt
When I input Chinese, I press the backspace key to delete the text and input the text and '@' again
I print the data of the keydown and keyup, but I don't know this logic, please help me analyze it.@dkwingsmt normally: kFlutterKeyEventTypeDown key: 160 scancode: 42
physical_key: 458977 eventual_logical_record: 8589934850
kFlutterKeyEventTypeDown key: 50 scancode: 3
physical_key: 458783 eventual_logical_record: 50
kFlutterKeyEventTypeUp key: 160 scancode: 42
erase physical_key: 458977
kFlutterKeyEventTypeUp key: 50 scancode: 3
erase physical_key: 458783
but in this device: kFlutterKeyEventTypeDown key: 160 scancode: 42
physical_key: 458977 eventual_logical_record: 8589934850
kFlutterKeyEventTypeDown key: 229 scancode: 3
kFlutterKeyEventTypeUp key: 229 scancode: 42
erase physical_key: 458977
I tried modifying this to avoid crashes.
flutter doctor -v
[√] Flutter (Channel stable, 2.10.3, on Microsoft Windows [Version 10.0.17763.316], locale zh-CN)
• Flutter version 2.10.3 at D:\flutter_2.10.3
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 7e9793dee1 (3 months ago), 2022-03-02 11:23:12 -0600
• Engine revision bd539267b4
• Dart version 2.16.1
• DevTools version 2.9.2
[X] Android toolchain - develop for Android devices
X Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.15)
• Visual Studio at d:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.11.32510.428
• Windows 10 SDK version 10.0.19041.0
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[√] VS Code (version 1.67.2)
• VS Code at C:\Users\yuchang.xu\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.40.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.17763.316]
• Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.54
• Edge (web) • edge • web-javascript • Microsoft Edge 101.0.1210.53
[√] HTTP Host Availability
• All required HTTP hosts are available
The 2.10.3 is an ancient version. A lot has been done for the keyboard on Windows. Can you take a look at the latest master channel and see if the problem exists?
Also @chifandeyu the flutter doctor output you posted here is contradictory with the original report as mentioned please try the latest stable 3.0.1 if the issue persists there then please try switching to master channel by running
flutter channel master
flutter upgrade
Also @chifandeyu the flutter doctor output you posted here is contradictory with the original report as mentioned please try the latest stable 3.0.1 if the issue persists there then please try switching to master channel by running
flutter channel master flutter upgrade
I try the latest stable 3.0.1 and master channel but the issue persists there.
[√] Flutter (Channel master, 3.1.0-0.0.pre.1035, on Microsoft Windows [版本 10.0.17763.316], locale zh-CN)
• Flutter version 3.1.0-0.0.pre.1035 at D:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 3d62732d60 (3 hours ago), 2022-06-01 00:14:14 -0400
• Engine revision 0d1057ef7b
• Dart version 2.18.0 (build 2.18.0-157.0.dev)
• DevTools version 2.13.1
[X] Android toolchain - develop for Android devices
X Unable to locate Android SDK.
Install Android Studio from: https://developer.android.com/studio/index.html
On first launch it will assist you in installing the Android SDK components.
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
If the Android SDK has been installed to a custom location, please use
`flutter config --android-sdk` to update to that location.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.15)
• Visual Studio at d:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.11.32510.428
• Windows 10 SDK version 10.0.19041.0
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[√] VS Code (version 1.67.2)
• VS Code at C:\Users\yuchang.xu\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.40.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [版本 10.0.17763.316]
• Chrome (web) • chrome • web-javascript • Google Chrome 101.0.4951.67
• Edge (web) • edge • web-javascript • Microsoft Edge 101.0.1210.53
[√] HTTP Host Availability
• All required HTTP hosts are available
Same exception:
An Observatory debugger and profiler on Windows is available at: http://127.0.0.1:49556/I1CapfADsj8=/
The Flutter DevTools debugger and profiler on Windows is available at:
http://127.0.0.1:9100?uri=http://127.0.0.1:49556/I1CapfADsj8=/
Unable to parse JSON message:
The document is empty.
══╡ 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#aac5c(physicalKey: PhysicalKeyboardKey#700e1(usbHidUsage: "0x000700e1", debugName:
"Shift Left"), logicalKey: LogicalKeyboardKey#00102(keyId: "0x200000102", keyLabel: "Shift Left",
debugName: "Shift Left"), character: null, timeStamp: 27:33:33.842200)
'package:flutter/src/services/hardware_keyboard.dart':
Failed assertion: line 425 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:425:16)
#3 HardwareKeyboard._assertEventIsRegular (package:flutter/src/services/hardware_keyboard.dart:436:6)
#4 HardwareKeyboard.handleKeyEvent (package:flutter/src/services/hardware_keyboard.dart:528:5)
#5 KeyEventManager.handleRawKeyMessage (package:flutter/src/services/hardware_keyboard.dart:874:37)
#6 BasicMessageChannel.setMessageHandler.<anonymous closure>
(package:flutter/src/services/platform_channel.dart:195:49)
#7 BasicMessageChannel.setMessageHandler.<anonymous closure>
(package:flutter/src/services/platform_channel.dart:194:47)
#8 _DefaultBinaryMessenger.setMessageHandler.<anonymous closure>
(package:flutter/src/services/binding.dart:382:35)
#9 _DefaultBinaryMessenger.setMessageHandler.<anonymous closure>
(package:flutter/src/services/binding.dart:379:46)
#10 _invoke2 (dart:ui/hooks.dart:186:13)
#11 _ChannelCallbackRecord.invoke (dart:ui/channel_buffers.dart:42:5)
#12 _Channel.push (dart:ui/channel_buffers.dart:132:31)
#13 ChannelBuffers.push (dart:ui/channel_buffers.dart:329:17)
#14 PlatformDispatcher._dispatchPlatformMessage (dart:ui/platform_dispatcher.dart:599:22)
#15 _dispatchPlatformMessage (dart:ui/hooks.dart:89:31)
(elided 2 frames from class _AssertionError)
════════════════════════════════════════════════════════════════════════════════════════════════════
Unable to parse JSON message:
The document is empty.
Another exception was thrown: 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#aac5c(physicalKey: PhysicalKeyboardKey#700e1(usbHidUsage: "0x000700e1", debugName: "ShiftLeft"), logicalKey: LogicalKeyboardKey#00102(keyId: "0x200000102", keyLabel: "Shift Left", debugName: "Shift
Left"), character: null, timeStamp: 27:33:33.842200)
Unable to parse JSON message:
The document is empty.
The 2.10.3 is an ancient version. A lot has been done for the keyboard on Windows. Can you take a look at the latest master channel and see if the problem exists?
I guess it is the different version of this system. The value of "shift" + number key combination pressed and release in Chinese input method is calculated incorrectly.
Thanks for guessing, but that doesn't really help me finding the issue. Can you try to find if you can reproduce this error on the latest master channel, and how?
Thanks for guessing, but that doesn't really help me finding the issue. Can you try to find if you can reproduce this error on the latest master channel, and how?
Ok. I have tried lastest master channel can reproduce this.
Can you explain the app and steps you used in the reproduction?
Can you explain the app and steps you used in the reproduction?
Can I communicate on discord?
Sure! You can find me by searching dkwingsmt in the flutter channel.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v
and a minimal reproduction of the issue.
cmputer model: thinkpad x250
systeminfo: windows 10.0.17763
flutter doctor:
exception: