Terminal class abstract

Abstract terminal interface for I/O operations.

This abstraction allows external users to provide their own stdin/stdout for testing, alternative terminal implementations, or custom environments.

Usage:

// Implement Terminal for custom behavior
class MyTerminal implements Terminal {
  @override
  TerminalInput get input => MyTerminalInput();

  @override
  TerminalOutput get output => MyTerminalOutput();
}

// Set as the current terminal
TerminalContext.current = MyTerminal();

Design principles:

  • Separation of input and output for partial customization
  • Mirror dart:io stdin/stdout APIs for easy implementation
  • No behavior changes from existing code

Constructors

Terminal()

Properties

hashCode → int
The hash code for this object.
no setterinherited
input → TerminalInput
The input stream for reading key events and managing terminal modes.
no setter
output → TerminalOutput
The output stream for writing content and querying terminal dimensions.
no setter
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