KeyEventManager class

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.
keyMessageHandler KeyMessageHandler?
The global entrance which handles all key events sent to Flutter.
read / write
runtimeType Type
A representation of the runtime type of the object.


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 nonexistent method or property is accessed.
toString() String
A string representation of this object.


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