Unverified Commit 4b3cf9bb authored by Bruno Leroux's avatar Bruno Leroux Committed by GitHub

Add reference to HardwareKeyboard in RawKeyboard documentation (#118607)

parent 6fafbc33
...@@ -585,6 +585,24 @@ typedef RawKeyEventHandler = bool Function(RawKeyEvent event); ...@@ -585,6 +585,24 @@ typedef RawKeyEventHandler = bool Function(RawKeyEvent event);
/// These key events are typically only key events generated by a hardware /// These key events are typically only key events generated by a hardware
/// keyboard, and not those from software keyboards or input method editors. /// keyboard, and not those from software keyboards or input method editors.
/// ///
/// ## Compared to [HardwareKeyboard]
///
/// [RawKeyboard] is the legacy API, and will be deprecated and removed in the
/// future. It is recommended to always use [HardwareKeyboard] and [KeyEvent]
/// APIs (such as [FocusNode.onKeyEvent]) to handle key events.
///
/// Behavior-wise, [RawKeyboard] provides a less unified, less regular
/// event model than [HardwareKeyboard]. For example:
///
/// * Down events might not be matched with an up event, and vice versa (the
/// set of pressed keys is silently updated).
/// * The logical key of the down event might not be the same as that of the up
/// event.
/// * Down events and repeat events are not easily distinguishable (must be
/// tracked manually).
/// * Lock modes (such as CapsLock) only have their "enabled" state recorded.
/// There's no way to acquire their pressing state.
///
/// See also: /// See also:
/// ///
/// * [RawKeyDownEvent] and [RawKeyUpEvent], the classes used to describe /// * [RawKeyDownEvent] and [RawKeyUpEvent], the classes used to describe
...@@ -592,6 +610,7 @@ typedef RawKeyEventHandler = bool Function(RawKeyEvent event); ...@@ -592,6 +610,7 @@ typedef RawKeyEventHandler = bool Function(RawKeyEvent event);
/// * [RawKeyboardListener], a widget that listens for raw key events. /// * [RawKeyboardListener], a widget that listens for raw key events.
/// * [SystemChannels.keyEvent], the low-level channel used for receiving /// * [SystemChannels.keyEvent], the low-level channel used for receiving
/// events from the system. /// events from the system.
/// * [HardwareKeyboard], the recommended replacement.
class RawKeyboard { class RawKeyboard {
RawKeyboard._(); RawKeyboard._();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment