TerminalFunctions class Terminal Utilities

Terminal Control Utilities

Provides static helper functions for querying terminal properties and controlling terminal modes such as entering and exiting fullscreen.

Wraps common ANSI escape codes for terminal control with safety checks to ensure terminal availability.

Example

if (TerminalFunctions.hasTerminal) {
  print('Terminal size: ${TerminalFunctions.terminalWidth}x${TerminalFunctions.terminalHeight}');
  TerminalFunctions.enterFullScreen();
  // ... run fullscreen UI ...
  TerminalFunctions.exitFullScreen();
}

See Also

  • stdout.hasTerminal: Platform API to check terminal presence.
  • ANSI escape codes documentation for terminal control sequences.

Constructors

TerminalFunctions.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

hasTerminal bool
Whether the current process's stdout is connected to a terminal.
no setter
terminalHeight int
Returns the current height (rows) of the terminal.
no setter
terminalWidth int
Returns the current width (columns) of the terminal.
no setter

Static Methods

enterFullScreen() → void
Switches the terminal into the "alternate" fullscreen buffer.
exitFullScreen() → void
Exits the "alternate" fullscreen buffer and returns to the normal screen.