InteractiveTerm class final

Terminal handle for interactive (tty) input.

Owns a background parser subscription that feeds both an EventQueue (pull API: tryEvent, awaitEvent, nextEvent) and a broadcast events stream (push API). Also holds raw-mode state.

Inheritance
Available extensions

Properties

backend TermBackend
Underlying transport. Exposed for tests that need to seed the event queue or inspect captured stdout, and for the documented raw-bytes recipe (term.backend.stdin.map(RawKeyEvent.new)).
no setterinherited
backgroundColor Future<Color?>
Terminal background color. OSC 11 first, then COLORFGBG.
no setter
cursorPosition Future<Pos?>
Read cursor position on the terminal. Returns null if unavailable.
no setter
events Stream<Event>
Broadcast stream of parsed events. Multiple subscribers supported.
no setter
foregroundColor Future<Color?>
Terminal foreground color. OSC 10 first, then COLORFGBG.
no setter
hashCode int
The hash code for this object.
no setterinherited
hasOutputTerminal bool
True if stdout is connected to an interactive terminal.
no setterinherited
hasTerminal bool
Always true for InteractiveTerm. Retained for ergonomic parity with hasOutputTerminal and for conditional logic in code that holds a Term.
no setter
isColorForced bool
True if CLICOLOR_FORCE is set in the environment.
no setterinherited
isFullyInteractive bool
True if both stdin and stdout are ttys.
no setter
newLine String
Newline sequence honoring raw-mode state (\r\n in raw mode, else \n).
no setter
profile ProfileEnum
The current terminal profile to use.
getter/setter pairinherited
queueLength int
Current buffered length of the internal event queue. Read-only diagnostic.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
terminalColumns int
Width of the terminal in characters. Falls back to COLUMNS or 80.
no setterinherited
terminalLines int
Height of the terminal in rows. Falls back to LINES or 25.
no setterinherited
termInfo TermInfo?
The most recent probe result, or null if probe was never called.
no setter

Methods

awaitEvent<T extends Event>({Duration? timeout}) Future<T?>
Wait for an event of type T, up to timeout.
clipboardClear(Clipboard clipboard) → void

Available on InteractiveTerm, provided by the TermUtils extension

Clear Clipboard contents
clipboardSet(Clipboard clipboard, String data) → void

Available on InteractiveTerm, provided by the TermUtils extension

Set Clipboard content
colorProfile() ProfileEnum
Resolve the color profile from TERM/COLORTERM without checking NO_COLOR/CLICOLOR_FORCE.
inherited
cursorHide() → void

Available on InteractiveTerm, provided by the CursorUtils extension

Hides the cursor.
cursorShow() → void

Available on InteractiveTerm, provided by the CursorUtils extension

Shows the cursor.
disableAlternateScreen() → void

Available on InteractiveTerm, provided by the TermUtils extension

Disable Alternate Screen
disableBlinking() → void

Available on InteractiveTerm, provided by the CursorUtils extension

Disables blinking of the terminal cursor.
disableBracketedPaste() → void

Available on InteractiveTerm, provided by the TermUtils extension

Disable bracketed paste mode.
disableColorPaletteUpdates() → void

Available on InteractiveTerm, provided by the TermUtils extension

Disable color palette update notifications.
disableInBandResize() → void

Available on InteractiveTerm, provided by the TermUtils extension

Disable in-band window resize reporting.
disableKeyboardEnhancement() → void

Available on InteractiveTerm, provided by the TermUtils extension

Disable keyboard enhancements
disableLineWrapping() → void

Available on InteractiveTerm, provided by the TermUtils extension

Disabled Line Wrapping
disableMouseEvents() → void

Available on InteractiveTerm, provided by the TermUtils extension

Stop receiving mouse events
disableRawMode() → void
Disables raw mode.
disableResizeEvents() → void

Available on InteractiveTerm, provided by the TermUtils extension

Disables resize event delivery.
disableUnicodeCore() → void

Available on InteractiveTerm, provided by the TermUtils extension

Disable Unicode Core
dispose() Future<void>
Dispose event plumbing. Pending awaitEvent/nextEvent futures complete with TermDisposed.
override
enableAlternateScreen() → void

Available on InteractiveTerm, provided by the TermUtils extension

Enable Alternate Screen
enableBlinking() → void

Available on InteractiveTerm, provided by the CursorUtils extension

Enables blinking of the terminal cursor.
enableBracketedPaste() → void

Available on InteractiveTerm, provided by the TermUtils extension

Enable bracketed paste mode.
enableColorPaletteUpdates() → void

Available on InteractiveTerm, provided by the TermUtils extension

Enable color palette update notifications.
enableInBandResize() → void

Available on InteractiveTerm, provided by the TermUtils extension

Enable in-band window resize reporting.
enableKeyboardEnhancement() → void

Available on InteractiveTerm, provided by the TermUtils extension

Enable keyboard enhancement
enableKeyboardEnhancementFull() → void

Available on InteractiveTerm, provided by the TermUtils extension

Enable keyboard enhancement with all parameters
enableLineWrapping() → void

Available on InteractiveTerm, provided by the TermUtils extension

Enabled Line Wrapping
enableMouseEvents() → void

Available on InteractiveTerm, provided by the TermUtils extension

Start receiving mouse events
enableRawMode() → void
Enables raw mode.
enableResizeEvents() → void

Available on InteractiveTerm, provided by the TermUtils extension

Enables resize event delivery, using in-band reporting where possible and a signal-based fallback everywhere else.
enableUnicodeCore() → void

Available on InteractiveTerm, provided by the TermUtils extension

Enable Unicode Core
endFocusTracking() → void

Available on InteractiveTerm, provided by the TermUtils extension

End receiving focus events
endSyncUpdate() → void

Available on InteractiveTerm, provided by the TermUtils extension

End synchronous update mode
envColorProfile() ProfileEnum
Resolve the color profile from environment variables.
inherited
envNoColor() bool
EnvNoColor returns true if the terminal should not emit colors based on the environment. NO_COLOR wins; CLICOLOR=="0" requires CLICOLOR_FORCE to flip back on. Piped stdout also forces no-color.
inherited
eraseClear() → void

Available on InteractiveTerm, provided by the EraseUtils extension

erase the screen and moves the cursor the top left position
eraseDown() → void

Available on InteractiveTerm, provided by the EraseUtils extension

Erase the screen from the current line down to the bottom of the screen.
eraseLine() → void

Available on InteractiveTerm, provided by the EraseUtils extension

Erase the entire current line, including the character at the cursor position.
eraseLineFromCursor() → void

Available on InteractiveTerm, provided by the EraseUtils extension

Erase from the current cursor position to the end of the current line.
eraseLineSaved() → void

Available on InteractiveTerm, provided by the EraseUtils extension

Erase the saved line.
eraseLineToCursor() → void

Available on InteractiveTerm, provided by the EraseUtils extension

Erase from the current cursor position to the start of the current line.
eraseSaved() → void

Available on InteractiveTerm, provided by the EraseUtils extension

Erase the saved lines.
eraseScreen() → void

Available on InteractiveTerm, provided by the EraseUtils extension

Erase the entire screen.
eraseUp() → void

Available on InteractiveTerm, provided by the EraseUtils extension

Erase the screen from the current line up to the top of the screen.
flush() Future<void>
Flush pending stdout without closing it or exiting the process.
inherited
flushThenExit(int status) Future<void>
Flush stdout and stderr, then exit with status. Never returns.
inherited

Available on InteractiveTerm, provided by the TermUtils extension

Write a hyperlink to the terminal.
isBackgroundDark({double factor = 0.5}) Future<bool?>
True if the background is dark (luminance < factor). Null if background color cannot be determined.
moveDown([int n = 1]) → void

Available on InteractiveTerm, provided by the CursorUtils extension

Moves the cursor down n cells.
moveHome() → void

Available on InteractiveTerm, provided by the CursorUtils extension

Moves the cursor to the top-left corner of the screen.
moveLeft([int n = 1]) → void

Available on InteractiveTerm, provided by the CursorUtils extension

Moves the cursor left n cells.
moveRight([int n = 1]) → void

Available on InteractiveTerm, provided by the CursorUtils extension

Moves the cursor right n cells.
moveTo(int row, int col) → void

Available on InteractiveTerm, provided by the CursorUtils extension

Moves the cursor to the given position (row, column)
moveToColumn(int n) → void

Available on InteractiveTerm, provided by the CursorUtils extension

Moves the cursor to the given column on the current row. The value is 0 based, meaning 0 is the leftmost column.
moveToNextLine([int n = 1]) → void

Available on InteractiveTerm, provided by the CursorUtils extension

Moves the cursor down the given number of lines.
moveToPrevLine([int n = 1]) → void

Available on InteractiveTerm, provided by the CursorUtils extension

Moves the cursor up the given number of lines.
moveToRow(int n) → void

Available on InteractiveTerm, provided by the CursorUtils extension

Moves the cursor to the given row on the current column. The value is 0 based, meaning 0 is the topmost row.
moveUp([int n = 1]) → void

Available on InteractiveTerm, provided by the CursorUtils extension

Moves the cursor up n cells.
nextEvent<T extends Event>() Future<T>
Wait indefinitely for the next event of type T.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notify(String title, String message) → void

Available on InteractiveTerm, provided by the TermUtils extension

Write a notification to the terminal.
popKeyboardFlags([int entries = 1]) → void

Available on InteractiveTerm, provided by the TermUtils extension

Pop keyboard flags from the stack
probe({Set<ProbeQuery> skip = const {}, int deadline = 500}) Future<TermInfo>
Probe terminal capabilities. The result is cached in termInfo and seeds the live tracked mode state (_seedModesFromProbe) so subsequent withModes save/restore starts from the terminal's actual state rather than assumed defaults.
pushKeyboardFlags(KeyboardEnhancementFlagsEvent flags) → void

Available on InteractiveTerm, provided by the TermUtils extension

Push keyboard flags to the stack
queryBracketedPaste({int timeout = defaultQueryTimeout}) Future<QueryBracketedPasteEvent?>

Available on InteractiveTerm, provided by the TermUtils extension

Query bracketed paste reporting status.
queryClipboard(Clipboard clipboard, {int timeout = defaultQueryTimeout}) Future<ClipboardCopyEvent?>

Available on InteractiveTerm, provided by the TermUtils extension

Query Clipboard content
queryColorScheme({int timeout = defaultQueryTimeout}) Future<ColorSchemeEvent?>

Available on InteractiveTerm, provided by the TermUtils extension

Query terminal color scheme preference (light/dark mode).
queryCursorPosition({int timeout = defaultQueryTimeout}) Future<CursorPositionEvent?>

Available on InteractiveTerm, provided by the CursorUtils extension

Queries the current cursor position.
queryInBandResize({int timeout = defaultQueryTimeout}) Future<QueryWindowResizeEvent?>

Available on InteractiveTerm, provided by the TermUtils extension

Query in-band window resize reporting status.
queryKeyboardCapabilities({int timeout = defaultQueryTimeout}) Future<KeyboardEnhancementFlagsEvent?>

Available on InteractiveTerm, provided by the TermUtils extension

Request keyboard capabilities
queryKeyboardEnhancementSupport({int timeout = defaultQueryTimeout}) Future<bool>

Available on InteractiveTerm, provided by the TermUtils extension

Query Keyboard enhancement support
queryOSCStatus(int status, {int timeout = defaultQueryTimeout}) Future<Color?>

Available on InteractiveTerm, provided by the TermUtils extension

Returns the current terminal status report.
queryPrimaryDeviceAttributes({int timeout = defaultQueryTimeout}) Future<PrimaryDeviceAttributesEvent?>

Available on InteractiveTerm, provided by the TermUtils extension

Query Primary Device Attributes
querySecondaryDeviceAttributes({int timeout = defaultQueryTimeout}) Future<SecondaryDeviceAttributesEvent?>

Available on InteractiveTerm, provided by the TermUtils extension

Query Secondary Device Attributes (DA2)
querySyncUpdate({int timeout = defaultQueryTimeout}) Future<QuerySyncUpdateEvent?>

Available on InteractiveTerm, provided by the TermUtils extension

Query Sync status
queryTerminalVersion({int timeout = defaultQueryTimeout}) Future<String>

Available on InteractiveTerm, provided by the TermUtils extension

Request terminal name and version
queryUnicodeCore({int timeout = defaultQueryTimeout}) Future<UnicodeCoreEvent?>

Available on InteractiveTerm, provided by the TermUtils extension

Query Unicode Core status
queryWindowSizeInPixels({int timeout = defaultQueryTimeout}) Future<QueryTerminalWindowSizeEvent?>

Available on InteractiveTerm, provided by the TermUtils extension

Query Terminal window size in pixels
readLine([ReadlineOptions options = const ReadlineOptions()]) Future<String?>
Read a line from the terminal with basic editing. Returns null on ESC.
restorePosition() → void

Available on InteractiveTerm, provided by the CursorUtils extension

Restores the cursor position.
savePosition() → void

Available on InteractiveTerm, provided by the CursorUtils extension

Saves the current cursor position.
scrollDown(int rows) → void

Available on InteractiveTerm, provided by the TermUtils extension

Scroll the terminal down by the specified number of rows.
scrollUp(int rows) → void

Available on InteractiveTerm, provided by the TermUtils extension

Scroll the terminal up by the specified number of rows.
setCursorStyle(CursorStyle style) → void

Available on InteractiveTerm, provided by the CursorUtils extension

Sets the cursor style.
setKeyboardFlags(KeyboardEnhancementFlagsEvent flags) → void

Available on InteractiveTerm, provided by the TermUtils extension

Set keyboard flags
setTerminalTitle(String title) → void

Available on InteractiveTerm, provided by the TermUtils extension

Set Terminal Title
softReset() → void

Available on InteractiveTerm, provided by the TermUtils extension

Soft Terminal reset
startFocusTracking() → void

Available on InteractiveTerm, provided by the TermUtils extension

Start receiving focus events
startSyncUpdate() → void

Available on InteractiveTerm, provided by the TermUtils extension

Start synchronous update mode
style({Color? fg, Color? bg, bool bold = false, bool faint = false, bool italic = false, bool blink = false, bool reverse = false, bool crossOut = false, bool overline = false, Underline underline = Underline.none, Color? underlineColor}) Style
Returns a Style object for the current profile.
inherited
toString() String
A string representation of this object.
inherited
tryEvent<T extends Event>() → T?
Poll for an event of type T without blocking.
withModes<T>(Future<T> fn(), {bool? rawMode, bool? alternateScreen, bool? mouseEvents, KeyboardEnhancement? keyboardEnhancement, bool? bracketedPaste, bool? inBandResize, bool? lineWrapping, bool? cursorVisible}) Future<T>
Run fn with the named terminal modes applied, restoring each to the state it had at scope entry once fn completes (normally or with error).
write(Object s) → void
Write the object's string representation to stdout.
inherited
writeAt(int row, int col, Object s) → void

Available on InteractiveTerm, provided by the CursorUtils extension

Write s at (row, col).
writeln(Object s) → void
Write the object's string representation followed by a newline.
override

Operators

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