read_key method

  1. @override
Key read_key()
override

Reads a single key from the input, including a variety of control characters.

Keys are represented by the Key class. Keys may be printable (if so, Key.isControl is false, and the Key.char property may be used to identify the key pressed. Non-printable keys have Key.isControl set to true, and if so the Key.char property is empty and instead the Key.controlChar property will be set to a value from the ControlCharacter enumeration that describes which key was pressed.

Owing to the limitations of terminal key handling, certain keys may be represented by multiple control key sequences. An example showing basic key handling can be found in the example/command_line.dart file in the package source code.

Implementation

@override
Key read_key() {
  set_raw_mode(true);
  final key = parse_key(
    buffer: const AnsiParserInputBufferStdinImpl(),
    delegate: const KeyDelegateKeyBindingsImpl(),
  );
  set_raw_mode(false);
  return key;
}