diff --git a/packages/flutter/lib/src/services/hardware_keyboard.dart b/packages/flutter/lib/src/services/hardware_keyboard.dart index 7c2af2bd84..ee994306f4 100644 --- a/packages/flutter/lib/src/services/hardware_keyboard.dart +++ b/packages/flutter/lib/src/services/hardware_keyboard.dart @@ -532,6 +532,10 @@ class HardwareKeyboard { } /// Query the engine and update _pressedKeys accordingly to the engine answer. + // + /// Both the framework and the engine maintain a state of the current pressed + /// keys. There are edge cases, related to startup and restart, where the framework + /// needs to resynchronize its keyboard state. Future syncKeyboardState() async { final Map? keyboardState = await SystemChannels.keyboard.invokeMapMethod( 'getKeyboardState', diff --git a/packages/flutter/lib/src/services/system_channels.dart b/packages/flutter/lib/src/services/system_channels.dart index 3a65302a2d..5311d36c7c 100644 --- a/packages/flutter/lib/src/services/system_channels.dart +++ b/packages/flutter/lib/src/services/system_channels.dart @@ -503,6 +503,10 @@ abstract final class SystemChannels { /// represents a pressed keyboard key. The entry key is the physical /// key ID and the entry value is the logical key ID. /// + /// Both the framework and the engine maintain a state of the current + /// pressed keys. There are edge cases, related to startup and restart, + /// where the framework needs to resynchronize its keyboard state. + /// /// See also: /// /// * [HardwareKeyboard.syncKeyboardState], which uses this channel to synchronize