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.

Constructors

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

Properties

hashCode int
The hash code for this object.
read-onlyinherited
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.
read-onlyinherited

Methods

clearState() → void
Reset the inferred platform transit mode and related states.
visibleForTesting">@visibleForTesting
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.
inherited
toString() String
A string representation of this object.
inherited

Operators

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