Terminal class

Server-safe representation of Flint's interactive browser terminal.

Inheritance

Constructors

Terminal({required String websocketUrl, TerminalController? controller, String title = 'Terminal', Object height = 400, bool showToolbar = true, bool autoConnect = true, bool autoReconnect = true, Duration reconnectDelay = const Duration(seconds: 2), bool sendResizeMessages = true, int fontSize = 13, String fontFamily = 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace', int scrollback = 5000, TerminalTheme theme = const TerminalTheme(), String connectingMessage = 'Connecting to terminal...', String scriptUrl = 'https://cdn.jsdelivr.net/npm/xterm@5.3.0/lib/xterm.js', String stylesheetUrl = 'https://cdn.jsdelivr.net/npm/xterm@5.3.0/css/xterm.css', String? className, Map<String, Object?> props = const {}, Map<String, Object?> style = const {}, DartStyle? dartStyle, void onConnectionStateChanged(TerminalConnectionState state)?, void onInput(String data)?, void onOutput(String data)?, void onResize(int columns, int rows)?, void onError(Object error)?})
Creates an interactive WebSocket terminal.

Properties

autoConnect bool
Whether to connect after the browser component mounts.
final
autoReconnect bool
Whether unexpected socket closures should be retried.
final
className String?
Optional wrapper class name.
final
connectingMessage String
Text written before the first connection attempt.
final
controller TerminalController?
Optional imperative terminal controller.
final
dartStyle DartStyle?
Additional typed wrapper styles.
final
fontFamily String
Terminal monospace font stack.
final
fontSize int
Terminal font size in pixels.
final
hashCode int
The hash code for this object.
no setterinherited
height Object
Terminal viewport height.
final
onConnectionStateChanged → void Function(TerminalConnectionState state)?
Called whenever the WebSocket connection state changes.
final
onError → void Function(Object error)?
Called when asset loading or the WebSocket reports an error.
final
onInput → void Function(String data)?
Called after keyboard input is sent.
final
onOutput → void Function(String data)?
Called when terminal output is received.
final
onResize → void Function(int columns, int rows)?
Called when the terminal calculates a new character grid size.
final
preserveState bool
Whether Flint should preserve this component instance across parent rerenders when the runtime type and tree position match.
no setterinherited
props Map<String, Object?>
Additional wrapper HTML properties.
final
reconnectDelay Duration
Delay before reconnecting a dropped socket.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scriptUrl String
xterm.js browser script URL.
final
scrollback int
Maximum number of retained terminal lines.
final
sendResizeMessages bool
Whether terminal size changes are sent as JSON resize envelopes.
final
showToolbar bool
Whether reconnect, clear, and copy actions are shown.
final
style Map<String, Object?>
Additional wrapper inline styles.
final
stylesheetUrl String
xterm.js stylesheet URL.
final
theme TerminalTheme
Light and dark xterm.js colors.
final
title String
Toolbar title.
final
websocketUrl String
WebSocket URL receiving keystrokes and producing terminal output.
final

Methods

attach(void scheduleRender()) → void
Attaches the render scheduler used by setState.
inherited
build() View?
Builds this component's renderable output.
override
didMount() → void
Called after the component is first mounted in the browser.
inherited
didUpdate() → void
Called after the component updates following a rerender.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setState(FlintStateUpdater update, {bool render = true}) → void
Applies update and schedules this component to render again.
inherited
shouldUpdate(covariant FlintComponent next) bool
Whether this component should rerender when it is updated from a new instance in the parent tree.
inherited
toString() String
A string representation of this object.
inherited
updateFrom(covariant FlintComponent next) → void
Receives the next component instance when Flint preserves this instance.
inherited
willUnmount() → void
Called before the component is removed from the tree.
inherited

Operators

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