Console class
A representation of the current console window.
Use the Console to get information about the current window and to read and write to it.
A comprehensive set of demos of using the Console class can be found in the
examples/ subdirectory.
Constructors
- Console()
- Console.scrolling({bool recordBlanks = true})
Properties
- cursorPosition ↔ Coordinate?
- 
  Returns the current cursor position as a coordinate.
  getter/setter pair
- hashCode → int
- 
  The hash code for this object.
  no setterinherited
- hasTerminal → bool
- 
  Whether there is a terminal attached to stdout.
  no setter
- newLine → String
- 
  Returns the current newline string.
  no setter
- rawMode ↔ bool
- 
  Returns whether the terminal is in raw mode.
  getter/setter pair
- runtimeType → Type
- 
  A representation of the runtime type of the object.
  no setterinherited
- supportsEmoji → bool
- 
  Returns whether the terminal supports Unicode emojis (👍)
  no setter
- windowHeight → int
- 
  Returns the height of the current console window in characters.
  no setter
- windowWidth → int
- 
  Returns the width of the current console window in characters.
  no setter
Methods
- 
  clearScreen() → void 
- Clears the entire screen
- 
  cursorDown() → void 
- Moves the cursor one position down.
- 
  cursorLeft() → void 
- Moves the cursor one position to the left.
- 
  cursorRight() → void 
- Moves the cursor one position to the right.
- 
  cursorUp() → void 
- Moves the cursor one position up.
- 
  eraseCursorToEnd() → void 
- Erases the current line from the cursor to the end of the line.
- 
  eraseLine() → void 
- Erases all the characters in the current line.
- 
  hideCursor() → void 
- Hides the cursor.
- 
  noSuchMethod(Invocation invocation) → dynamic 
- 
  Invoked when a nonexistent method or property is accessed.
  inherited
- 
  readKey() → KeyStroke 
- Reads a single key from the input, including a variety of control characters.
- 
  readLine({bool cancelOnBreak = false, bool cancelOnEscape = false, bool cancelOnEOF = false, void callback(String text, KeyStroke lastPressed)?}) → String? 
- Reads a line of input, handling basic keyboard navigation commands.
- 
  resetColorAttributes() → void 
- Resets all color attributes and text styles to the default terminal setting.
- 
  resetCursorPosition() → void 
- Moves the cursor to the top left corner of the screen.
- 
  setBackgroundColor(ConsoleColor background) → void 
- Sets the console background color to a named ANSI color.
- 
  setBackgroundExtendedColor(int colorValue) → void 
- Sets the background to one of 256 extended ANSI colors.
- 
  setForegroundColor(ConsoleColor foreground) → void 
- Sets the console foreground color to a named ANSI color.
- 
  setForegroundExtendedColor(int colorValue) → void 
- Sets the foreground to one of 256 extended ANSI colors.
- 
  setTextStyle({bool bold = false, bool faint = false, bool italic = false, bool underscore = false, bool blink = false, bool inverted = false, bool invisible = false, bool strikethru = false}) → void 
- Sets the text style.
- 
  showCursor() → void 
- Shows the cursor.
- 
  toString() → String 
- 
  A string representation of this object.
  inherited
- 
  write(Object text) → void 
- Writes the text to the console.
- 
  writeAligned(Object text, [int? width, TextAlignment alignment = TextAlignment.left]) → void 
- Writes a quantity of text to the console with padding to the given width.
- 
  writeErrorLine(Object text) → void 
- Writes an error message to the console, with newline automatically appended.
- 
  writeLine([Object? text, TextAlignment alignment = TextAlignment.left]) → void 
- Writes a line to the console, optionally with alignment provided by the TextAlignment enumeration.
Operators
- 
  operator ==(Object other) → bool 
- 
  The equality operator.
  inherited