registerGlobalHandlers method Null safety

void registerGlobalHandlers()

Registers global input event handlers that are needed to manage focus.

This sets the RawKeyboard.keyEventHandler for the shared instance of RawKeyboard and adds a route to the global entry in the gesture routing table. As such, only one FocusManager instance should register its global handlers.

When this focus manager is no longer needed, calling dispose on it will unregister these handlers.

Implementation

void registerGlobalHandlers() {
  assert(ServicesBinding.instance!.keyEventManager.keyMessageHandler == null);
  ServicesBinding.instance!.keyEventManager.keyMessageHandler = _handleKeyMessage;
  GestureBinding.instance!.pointerRouter.addGlobalRoute(_handlePointerEvent);
}