injectLogicalKey method

void injectLogicalKey(
  1. LogicalKeyboardKey key
)

Implementation

void injectLogicalKey(LogicalKeyboardKey key) {
  final injector = _keyInjector;
  if (injector != null) {
    _onTerminalInputStart();
    injector.injectKey(key);
    return;
  }
  if (_ime.isComposing) _ime.resetComposing();
  final hw = HardwareKeyboard.instance;
  final bytes = encodeKey(
    key,
    null,
    shift: hw.isShiftPressed,
    alt: hw.isAltPressed,
    ctrl: hw.isControlPressed,
    meta: hw.isMetaPressed,
    modeFlags: _grid.modeFlags,
  );
  if (bytes == null) return;
  _onTerminalInputStart();
  _writeToEngine(bytes);
}