FlutterTerminal class final
A custom terminal implementation managed by the Flutter frontend.
It acts as the bridge between Flutter's lifecycle and layout engine, and the termui package. It manages the active terminal size, listens for GUI-based events (keyboard, mouse), and manages font sizing/scaling.
It provides utility methods to dynamically change the scale (font size) of the rendered terminal and lets the renderer adapt layout properties.
Example Usage
final terminal = FlutterTerminal(initialFontSize: 14.0);
terminal.watchFontSize().listen((newSize) {
print('Font size adjusted to: $newSize');
});
terminal.increaseFontSize(2.0);
- Inheritance
-
- Object
- Terminal
- FlutterTerminal
Constructors
- FlutterTerminal({double initialFontSize = 13.0})
- Creates a new FlutterTerminal instance.
Properties
- backend → TerminalBackend
-
The underlying platform-specific terminal implementation.
finalinherited
-
events
→ Stream<
InputEvent> -
A stream of all incoming input events from the terminal.
no setteroverride
- fontSize → double
-
Returns the current font size used to render the terminal.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
mouseCursorChanges
→ Stream<
String?> -
Stream emitting changes to the TUI's requested mouse cursor.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
size
→ Future<
Point< int> > -
Retrieves the current dimensions (width and height) of the terminal.
no setteroverride
Methods
-
clear(
) → void -
Clears the entire terminal screen.
inherited
-
cursorPosition(
) → Future< Point< int> > -
Requests the current coordinates of the cursor asynchronously.
inherited
-
decreaseFontSize(
[double delta = 1.0]) → void -
Decreases the current font size by
delta. -
detectAmbiguousWidth(
) → Future< bool> -
Detects whether the active terminal emulator renders East Asian Ambiguous
characters as wide (2 cells) or narrow (1 cell) by querying cursor advance.
inherited
-
disableBracketedPaste(
) → void -
Sends the sequence to disable bracketed paste mode.
inherited
-
disableMouseTracking(
) → void -
Sends the sequence to disable mouse tracking.
inherited
-
dispose(
) → void -
Disposes of the terminal resources and disables raw mode.
override
-
enableBracketedPaste(
) → void -
Sends the sequence to enable bracketed paste mode.
inherited
-
enableMouseTracking(
) → void -
Sends the sequence to enable mouse tracking.
inherited
-
enterAlternateScreen(
) → void -
Sends the sequence to enter the alternate screen buffer.
inherited
-
exitAlternateScreen(
) → void -
Sends the sequence to exit the alternate screen buffer.
inherited
-
goto(
{required int x, required int y}) → void -
Moves the cursor to the specified 1-based
xandycoordinates.inherited -
hideCursor(
) → void -
Sends the sequence to hide the terminal cursor.
inherited
-
home(
) → void -
Moves the cursor to the top-left corner (home) of the terminal.
inherited
-
increaseFontSize(
[double delta = 1.0]) → void -
Increases the current font size by
delta. -
injectEvent(
InputEvent event) → void -
Injects a
core_event.InputEventinto the event loop stream. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readInput(
) → Future< InputEvent> -
Reads a single input event from the terminal asynchronously.
inherited
-
relative(
{Direction dir = Direction.down, required int places}) → void -
Moves the cursor a relative number of
placesin the givendirdirection.inherited -
resetMousePointer(
) → void -
Resets the mouse pointer shape back to the terminal's default pointer.
inherited
-
resetStyle(
) → void -
Sends the sequence to reset all cell styling back to default.
inherited
-
setFontSize(
double size) → void -
Sets the rendering font size, clamped between
4.0and72.0. -
setMousePointer(
MousePointer pointer) → void -
Sets the mouse pointer shape to the specified
pointertype.inherited -
showCursor(
) → void -
Sends the sequence to show the terminal cursor.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
updateSize(
Point< int> newSize) → void - Updates the underlying terminal size and resolves the size future.
-
watchFontSize(
) → Stream< double> - A stream that emits the font size whenever it changes.
-
watchSize(
) → Stream< Point< int> > -
Returns a stream that emits new dimensions whenever the terminal is resized.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited