Add more documentation for SystemChannels.keyboard getKeyboardState (#133663)

## Description

This PR adds some documentation to SystemChannels.keyboard getKeyboardState.
This method was added in https://github.com/flutter/flutter/pull/122885.

## Related Issue

Fixes https://github.com/flutter/flutter/issues/132938.

## Tests

Documentation only.
This commit is contained in:
Bruno Leroux 2023-09-01 11:24:33 +02:00 committed by GitHub
parent 510ecaa4e7
commit e326199923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -532,6 +532,10 @@ class HardwareKeyboard {
} }
/// Query the engine and update _pressedKeys accordingly to the engine answer. /// 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<void> syncKeyboardState() async { Future<void> syncKeyboardState() async {
final Map<int, int>? keyboardState = await SystemChannels.keyboard.invokeMapMethod<int, int>( final Map<int, int>? keyboardState = await SystemChannels.keyboard.invokeMapMethod<int, int>(
'getKeyboardState', 'getKeyboardState',

View File

@ -503,6 +503,10 @@ abstract final class SystemChannels {
/// represents a pressed keyboard key. The entry key is the physical /// represents a pressed keyboard key. The entry key is the physical
/// key ID and the entry value is the logical key ID. /// 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: /// See also:
/// ///
/// * [HardwareKeyboard.syncKeyboardState], which uses this channel to synchronize /// * [HardwareKeyboard.syncKeyboardState], which uses this channel to synchronize