rawMode property

bool rawMode

Returns whether the terminal is in raw mode.

There are a series of flags applied to a UNIX-like terminal that together constitute 'raw mode'. These flags turn off echoing of character input, processing of input signals like Ctrl+C, and output processing, as well as buffering of input until a full line is entered.

Implementation

bool get rawMode => _isRawMode;
void rawMode=(bool value)

Enables or disables raw mode.

There are a series of flags applied to a UNIX-like terminal that together constitute 'raw mode'. These flags turn off echoing of character input, processing of input signals like Ctrl+C, and output processing, as well as buffering of input until a full line is entered.

Raw mode is useful for console applications like text editors, which perform their own input and output processing, as well as for reading a single key from the input.

In general, you should not need to enable or disable raw mode explicitly; you should call the readKey command, which takes care of handling raw mode for you.

If you use raw mode, you should disable it before your program returns, to avoid the console being left in a state unsuitable for interactive input.

When raw mode is enabled, the newline command (\n) does not also perform a carriage return (\r). You can use the newLine property or the writeLine function instead of explicitly using \n to ensure the correct results.

Implementation

set rawMode(bool value) {
  _isRawMode = value;
  if (value) {
    _termlib.enableRawMode();
  } else {
    _termlib.disableRawMode();
  }
}