@@ -585,13 +585,32 @@ typedef RawKeyEventHandler = bool Function(RawKeyEvent event);
585
585
/// These key events are typically only key events generated by a hardware
586
586
/// keyboard, and not those from software keyboards or input method editors.
587
587
///
588
+ /// ## Compared to [HardwareKeyboard]
589
+ ///
590
+ /// [RawKeyboard] is the legacy API, and will be deprecated and removed in the
591
+ /// future. It is recommended to always use [HardwareKeyboard] and [KeyEvent]
592
+ /// APIs (such as [FocusNode.onKeyEvent] ) to handle key events.
593
+ ///
594
+ /// Behavior-wise, [RawKeyboard] provides a less unified, less regular
595
+ /// event model than [HardwareKeyboard] . For example:
596
+ ///
597
+ /// * Down events might not be matched with an up event, and vice versa (the
598
+ /// set of pressed keys is silently updated).
599
+ /// * The logical key of the down event might not be the same as that of the up
600
+ /// event.
601
+ /// * Down events and repeat events are not easily distinguishable (must be
602
+ /// tracked manually).
603
+ /// * Lock modes (such as CapsLock) only have their "enabled" state recorded.
604
+ /// There's no way to acquire their pressing state.
605
+ ///
588
606
/// See also:
589
607
///
590
608
/// * [RawKeyDownEvent] and [RawKeyUpEvent] , the classes used to describe
591
609
/// specific raw key events.
592
610
/// * [RawKeyboardListener] , a widget that listens for raw key events.
593
611
/// * [SystemChannels.keyEvent] , the low-level channel used for receiving
594
612
/// events from the system.
613
+ /// * [HardwareKeyboard] , the recommended replacement.
595
614
class RawKeyboard {
596
615
RawKeyboard ._();
597
616
0 commit comments