KeyMessage class Null safety

The assumbled information corresponding to a native key message.

While Flutter's KeyEvents are created from key messages from the native platform, every native message might result in multiple KeyEvents. For example, this might happen in order to synthesize missed modifier key presses or releases.

A KeyMessage bundles all information related to a native key message together for the convenience of propagation on the FocusNode tree.

When dispatched to handlers or listeners, or propagated through the FocusNode tree, all handlers or listeners belonging to a node are executed regardless of their KeyEventResult, and all results are combined into the result of the node using combineKeyEventResults. Empty events or rawEvent should be considered as a result of KeyEventResult.ignored.

In very rare cases, a native key message might not result in a KeyMessage. For example, key messages for Fn key are ignored on macOS for the convenience of cross-platform code.



KeyMessage(List<KeyEvent> events, RawKeyEvent? rawEvent)
Create a KeyMessage by providing all information.


events List<KeyEvent>
The list of KeyEvents converted from the native key message.
hashCode int
The hash code for this object.
read-only, inherited
rawEvent RawKeyEvent?
The native key message in the form of a raw key event.
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
toString() String
A string representation of this object.


operator ==(Object other) bool
The equality operator.