TerminalInfo class

Provides safe, cached access to terminal dimensions with sensible defaults.

Instead of duplicating terminal size queries across components, use this centralized utility:

final cols = TerminalInfo.columns;
final rows = TerminalInfo.rows;
final size = TerminalInfo.size;

Why centralize?

  • Consistent fallback defaults (80×24)
  • Single point for error handling
  • Easy to test/mock via TerminalContext
  • Reduces boilerplate in views and prompts

Constructors

TerminalInfo()

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

columns int
Returns the current terminal width in columns.
no setter
hasTerminal bool
Whether a terminal is available.
no setter
rows int
Returns the current terminal height in rows.
no setter
size TerminalSize
Returns both dimensions as a record.
no setter

Constants

defaultColumns → const int
Default fallback width when terminal is unavailable.
defaultRows → const int
Default fallback height when terminal is unavailable.