XtermTerminalView class
A TerminalView backed by xterm.js. Requires the xterm UMD bundle + fit
addon to be loaded on the page (see web/index.html; tool/copy_assets.dart
installs them into a consuming app).
- Implemented types
Constructors
- XtermTerminalView(HTMLElement parent, {XtermTheme theme = XtermTheme.omnyShell, int fontSize = 13, String fontFamily = defaultFontFamily, int scrollback = 5000})
-
Creates the terminal inside
parentand fits it to the container.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- selection → String
-
The currently selected text (empty when there is no selection).
no setteroverride
- size → ({int cols, int rows})
-
Current terminal size in columns/rows.
no setteroverride
Methods
-
cancelAutoFit(
) → void - Cancels the deferred initial auto-fit. The session screen calls this in fixed-dimension mode, where it pins the columns/rows itself and the fit addon would otherwise override them once these timers fire.
-
clearSelection(
) → void -
Clears any active selection.
override
-
dispose(
) → void -
Disposes the terminal and detaches listeners.
override
-
fit(
) → void - Refits the terminal to its container (call after layout/resize). Safe to call before the container has a measurable size — fit failures are ignored.
-
focus(
) → void -
Gives the terminal keyboard focus.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onInput(
void handler(String data)) → void -
Registers
handlerfor user keystrokes (xterm delivers a decoded string).override -
onResize(
void handler(int cols, int rows)) → void -
Registers
handlerfor terminal resize (new column/row counts).override -
refresh(
) → void - Forces a redraw of every visible row (the canvas can go stale after a layout change such as exiting fullscreen).
-
resize(
int cols, int rows) → void -
Pins the terminal to an explicit
cols×rows(no-op in xterm when unchanged, so it won't spuriously fire a resize event). Guarded like the other JS calls in case it lands on a not-yet-ready or disposed terminal. -
scrollToBottom(
) → void -
Scrolls the viewport to the bottom (the latest output / prompt).
override
-
setFontSize(
int px) → void - Sets the rendered font size in CSS pixels. Re-renders glyphs at the new size but does not change the column/row count on its own — only fit or resize do — which is exactly what a fixed-dimension session needs.
-
toString(
) → String -
A string representation of this object.
inherited
-
write(
List< int> bytes) → void -
Writes raw output
bytesto the terminal.override -
writeText(
String text) → void -
Writes a UTF-8
textline (used for local status notices).override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
- defaultFontFamily → const String
- The default monospace stack — the system's own, so no font is shipped.