open static method

Future<CliSession> open(
  1. CliTerminal terminal, {
  2. ThemeData? theme,
  3. void onInterrupt()?,
})

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. onInterrupt is called once the app has ended on a Ctrl+C nothing live took.

Implementation

static Future<CliSession> open(
  CliTerminal terminal, {
  ThemeData? theme,
  void Function()? onInterrupt,
}) 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, onInterrupt);
  session._running = clock.run(() => binding.run(_Host(session)));
  unawaited(session._watch());
  return session;
}