Skip to content

Commit e326199

Browse files
authored
Add more documentation for SystemChannels.keyboard getKeyboardState (#133663)
## Description This PR adds some documentation to SystemChannels.keyboard getKeyboardState. This method was added in flutter/flutter#122885. ## Related Issue Fixes flutter/flutter#132938. ## Tests Documentation only.
1 parent 510ecaa commit e326199

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

packages/flutter/lib/src/services/hardware_keyboard.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,10 @@ class HardwareKeyboard {
532532
}
533533

534534
/// Query the engine and update _pressedKeys accordingly to the engine answer.
535+
//
536+
/// Both the framework and the engine maintain a state of the current pressed
537+
/// keys. There are edge cases, related to startup and restart, where the framework
538+
/// needs to resynchronize its keyboard state.
535539
Future<void> syncKeyboardState() async {
536540
final Map<int, int>? keyboardState = await SystemChannels.keyboard.invokeMapMethod<int, int>(
537541
'getKeyboardState',

packages/flutter/lib/src/services/system_channels.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,10 @@ abstract final class SystemChannels {
503503
/// represents a pressed keyboard key. The entry key is the physical
504504
/// key ID and the entry value is the logical key ID.
505505
///
506+
/// Both the framework and the engine maintain a state of the current
507+
/// pressed keys. There are edge cases, related to startup and restart,
508+
/// where the framework needs to resynchronize its keyboard state.
509+
///
506510
/// See also:
507511
///
508512
/// * [HardwareKeyboard.syncKeyboardState], which uses this channel to synchronize

0 commit comments

Comments
 (0)