Reusable launch target for a Program.
Use ProgramHost to package backend selection separately from model logic. The current runtime supports:
- ProgramHost.stdio for the built-in stdio host
- ProgramHost.backend for backend-driven embedded/native hosts
- ProgramHost.bridge for ergonomic embedded/web bridge hosts
- ProgramHost.jsonChannel for message-oriented JSON transports
- ProgramHost.webSocket for websocket JSON bridge hosts
- ProgramHost.terminal for an already-created terminal
- ProgramHost.split for separate control/output terminals
- ProgramHost.custom for embedding adapters and future backends
Constructors
- ProgramHost.backend(TerminalBackend backend)
-
Creates a host backed by
backend.factory - ProgramHost.bridge(TerminalBridge bridge)
-
Creates a host backed by
bridge.factory - ProgramHost.custom(ProgramHostResolver resolver)
-
Creates a custom host using
resolver.factory -
ProgramHost.jsonChannel({required void sendMessage(String message), required Stream<
Object?> inboundMessages, Future<void> flushMessages()?, Future<void> closeTransport()?, TerminalDimensions initialSize = (width: 80, height: 24), bool supportsAnsi = true, bool isTerminal = true, ColorProfile colorProfile = ColorProfile.trueColor, ({bool useBackspace, bool useTabs}) movementCaps = (useTabs: false, useBackspace: true)}) -
Creates a host backed by a JSON message channel.
factory
- ProgramHost.socket(Socket socket, {TerminalDimensions initialSize = (width: 80, height: 24), bool supportsAnsi = true, ColorProfile colorProfile = ColorProfile.trueColor, bool closeSocketOnDispose = true})
-
Creates a socket-backed host for remote or shell-mode terminals.
factory
- ProgramHost.split({required TuiTerminal control, required TuiTerminal output})
-
Creates a split host with separate
controlandoutputterminals.factory - ProgramHost.stdio({bool inputTTY = false})
-
Creates a stdio-backed host.
factory
- ProgramHost.terminal(TuiTerminal terminal)
-
Creates a host that always uses
terminal.factory - ProgramHost.webSocket(WebSocket socket, {TerminalDimensions initialSize = (width: 80, height: 24), bool supportsAnsi = true, bool isTerminal = true, ColorProfile colorProfile = ColorProfile.trueColor, ({bool useBackspace, bool useTabs}) movementCaps = (useTabs: false, useBackspace: true), bool closeSocketOnDispose = true})
-
Creates a websocket-backed host using the JSON bridge protocol.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- 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
-
resolve(
ProgramOptions options) → ProgramHostBinding -
Resolves the host against
options. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited