KeyEventManager class Null safety

A singleton class that processes key messages from the platform and dispatches converted messages accordingly.

KeyEventManager receives platform key messages by handleKeyData and handleRawKeyMessage, sends converted events to HardwareKeyboard and RawKeyboard for recording keeping, and then dispatches the KeyMessage to keyMessageHandler, the global message handler.

KeyEventManager also resolves cross-platform compatibility of keyboard implementations. Legacy platforms might have not implemented the new key data API and only send raw key data on each key message. KeyEventManager recognize platform types as KeyDataTransitMode and dispatches events in different ways accordingly.

KeyEventManager is typically created, owned, and invoked by ServicesBinding.


KeyEventManager(HardwareKeyboard _hardwareKeyboard, RawKeyboard _rawKeyboard)
Create an instance.


hashCode int
The hash code for this object.
read-only, inherited
keyMessageHandler KeyMessageHandler?
The global handler for all hardware key messages of Flutter.
read / write
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


clearState() → void
Reset the inferred platform transit mode and related states.
handleKeyData(KeyData data) bool
Dispatch a key data to global and leaf listeners.
handleRawKeyMessage(dynamic message) Future<Map<String, dynamic>>
Handles a raw key message.
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.