injectKey method

void injectKey(
  1. LogicalKeyboardKey key
)

Implementation

void injectKey(LogicalKeyboardKey key) {
  if (isComposing()) resetComposing();
  final hadLatch = latch.ctrl || latch.alt || latch.shift;
  final bytes = encodeKey(
    key,
    null,
    ctrl: latch.ctrl,
    alt: latch.alt,
    shift: latch.shift,
    modeFlags: modeFlags(),
  );
  if (bytes != null) write(bytes);
  if (hadLatch) latch.consumeAfterSend();
}