Repository: flutter
Issue: [macOS] occasionally Shift keyPressed throws failed assertion exception
Labels: engine,platform-mac,a: desktop,P2,team-macos,triaged-macos

Actually has a similar issue with related but not the same bug: #67866

```bash
======== Exception caught by services library ======================================================
The following assertion was thrown during a platform message callback:
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#ab7ae(logicalKey: LogicalKeyboardKey#700e1(keyId: "0x1000700e1", keyLabel: "", debugName: "Shift Left"), physicalKey: PhysicalKeyboardKey#700e1(usbHidUsage: "0x000700e1", debugName: "Shift Left")) and its data: RawKeyEventDataMacOs(keyLabel: , keyCode: 56, characters: , unmodifiedCharacters: , modifiers: 256, modifiers down: {})
'package:flutter/src/services/raw_keyboard.dart':
Failed assertion: line 626 pos 12: 'event is! RawKeyDownEvent || _keysPressed.isNotEmpty'


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      RawKeyboard._handleKeyEvent (package:flutter/src/services/raw_keyboard.dart:626:12)
#3      BasicMessageChannel.setMessageHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:77:49)
#4      BasicMessageChannel.setMessageHandler.<anonymous closure> (package:flutter/src/services/platform_channel.dart:76:47)
#5      _DefaultBinaryMessenger.handlePlatformMessage (package:flutter/src/services/binding.dart:284:33)
#6      _DefaultBinaryMessenger.setMessageHandler.<anonymous closure> (package:flutter/src/services/binding.dart:318:15)
...
====================================================================================================
```

code：
```dart
import 'package:flutter/material.dart';

void main() {
  runApp(Scaper());
}

class Scaper extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false, // Hide the debug banner
      theme: ThemeData.light(),
      color: Colors.white,
      home: Scaffold(
          body: SafeArea(
        child: Padding(
            padding: EdgeInsets.all(12),
            child: Text("Whampoa Pagoda", style: TextStyle(fontSize: 28, fontWeight: FontWeight.bold))), // Main Content
      )),
    );
  }
}
```

But when i run this application, I just press Shift to enter uppercase char in Android Studio

```penguin@Penguins-MBP Ditiezu_Flutter % flutter doctor -v
[✓] Flutter (Channel dev, 1.26.0-1.0.pre, on macOS 11.1 20C69 darwin-x64, locale en-CN)
    • Flutter version 1.26.0-1.0.pre at /usr/local/bin/flutter
    • Framework revision 63062a6443 (5 weeks ago), 2020-12-13 23:19:13 +0800
    • Engine revision 4797b06652
    • Dart version 2.12.0 (build 2.12.0-141.0.dev)
    • Pub download mirror https://mirrors.tuna.tsinghua.edu.cn/dart-pub
    • Flutter download mirror https://mirrors.tuna.tsinghua.edu.cn/flutter

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/penguin/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Users/penguin/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7049475/Android Studio
      Preview.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 12.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.3, Build version 12C33
    • CocoaPods version 1.9.3

[✓] Android Studio
    • Android Studio at /Users/penguin/Library/Application
      Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/202.7049475/Android Studio Preview.app/Contents
    • 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.8+10-b944.6842174)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.3)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • 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

[✓] IntelliJ IDEA Ultimate Edition (version 2020.3.1)
    • IntelliJ at /Users/penguin/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
    • 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 (3 available)
    • M2007J17C (mobile)      • 168f8adf                                 • android-arm64 • Android 10 (API 29)
    • Penguin‘s iPad (mobile) • af3ba694650b7e6f43eca2278fc662028905ce4e • ios           • iOS 14.3
    • macOS (desktop)         • macos                                    • darwin-x64    • macOS 11.1 20C69 darwin-x64

! Doctor found issues in 1 category.
```