This issue is related to #97789. In a similar monkey keyboard test under Windows, occasionally asserts are seen and Shift key gets stuck (seen as changing text selection as mouse button is clicked over the text field).

Steps to Reproduce
- Execute
flutter run on the code sample (just a text field)
- Run a "monkey keyboard stress test" pressing left and right Shift, Alt, Windows, Ctrl buttons with some keys that produce text - completely randomly and often pressing multiple buttons at a time.
Expected results: Shift key keeps working normally, no asserts
Actual results: Shift key gets stuck, asserts
Code sample
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(primarySwatch: Colors.blue),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() { _counter++; });
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text(widget.title)),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('You have pushed the button this many times:'),
Text(
'$_counter',
style: Theme.of(context).textTheme.headline4,
),
const Expanded(
child: TextField(maxLines: null),
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}
Logs
flutter doctor -v
[√] Flutter (Channel master, 2.11.0-0.0.pre.483, on Microsoft Windows [Version 10.0.19044.1469], locale en-US)
• Flutter version 2.11.0-0.0.pre.483 at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4f975cbe2f (87 minutes ago), 2022-02-08 13:05:21 -0800
• Engine revision 7bf74069a5
• Dart version 2.17.0 (build 2.17.0-87.0.dev)
• DevTools version 2.10.0
[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 (x86)\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.8)
• Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
• Visual Studio Community 2019 version 16.11.32002.261
• 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, 64-bit edition (version 1.64.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 3.34.0
[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.1469]
• Chrome (web) • chrome • web-javascript • Google Chrome 97.0.4692.99
• Edge (web) • edge • web-javascript • Microsoft Edge 97.0.1072.76
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 2 categories.
This issue is related to #97789. In a similar monkey keyboard test under Windows, occasionally asserts are seen and Shift key gets stuck (seen as changing text selection as mouse button is clicked over the text field).
Steps to Reproduce
flutter runon the code sample (just a text field)Expected results: Shift key keeps working normally, no asserts
Actual results: Shift key gets stuck, asserts
Code sample
Logs