wait method
Returns a Future that completes when the program exits.
This is useful when you need to wait for the program to finish from outside code, such as in tests or when embedding the TUI in a larger application.
final program = Program(MyModel());
// Start the program
final runFuture = program.run();
// Later, wait for it to complete
await program.wait();
Implementation
Future<void> wait() async {
if (!_running) return;
await _runCompleter?.future;
}