open static method
Future<CliSession>
open(
- CliTerminal terminal, {
- ThemeData? theme,
- TwkStrings strings = const TwkStrings(),
- void onInterrupt()?,
- void onWarning(
- String message
Opens the session on terminal's inline terminal
(CliTerminal.openInline), the app's frames timed by its clock;
widgets are shown under theme where there is one, else under the
terminal's colors, and in the words strings. onInterrupt is
called once the app has ended on a Ctrl+C nothing live took.
onWarning gets what the session warns
of (a list committed with items and no rows); without one it goes to
log as a warning.
Implementation
static Future<CliSession> open(
CliTerminal terminal, {
ThemeData? theme,
TwkStrings strings = const TwkStrings(),
void Function()? onInterrupt,
void Function(String message)? onWarning,
}) async {
final clock = terminal.clock;
final backend = await clock.run(terminal.openInline);
final binding = clock.run(
() => AppBinding(
backend,
clearInlineOnExit: true,
clock: clock.stopwatch(),
),
);
final session = CliSession._(
binding,
theme,
strings,
onInterrupt,
onWarning,
);
session._running = clock.run(() => binding.run(_Host(session)));
unawaited(session._watch());
return session;
}