Program options
Configure a Program with one composable options list for renderer behavior, input tracking and message filtering.
Configuring a Program
dart
Program(
options: [
withFps(60), // default 60, max 120
withCellRenderer(), // cell-level diff (less flicker on older terminals)
withAltScreen(), // enter alternate screen buffer
withHideCursor(), // hide terminal cursor
withTickInterval(const Duration(milliseconds: 100)), // global tick rate
withMouseCellMotion(), // enable button-event mouse tracking
withMouseAllMotion(), // enable all-motion mouse tracking
withReportFocus(), // enable focus/blur reporting (FocusMsg / BlurMsg)
withWindowSize(120, 40), // inject a fixed window size (useful in tests)
withLogFile(File('debug.log')), // append renderer output to a file
withFilter((model, msg) { // intercept / transform messages
if (msg is QuitMsg) return null; // suppress
return msg;
}),
],
).run(MyModel());| Option | Effect |
|---|---|
| withFps(n) | Cap screen output frame rate (default 60, max 120). |
| withCellRenderer() | Use the cell-level diff renderer for older terminals. |
| withAltScreen() | Render on the alternate screen buffer. |
| withHideCursor() | Hide the terminal cursor. |
| withTickInterval(duration) | Deliver TickMsg values on a fixed interval. |
| withMouseCellMotion() / withMouseAllMotion() | Enable mouse tracking. |
| withReportFocus() | Deliver FocusMsg / BlurMsg on focus changes. |
| withWindowSize(w, h) | Inject a fixed window size (handy in tests). |
| withLogFile(file) | Append renderer output to a file. |
| withFilter(fn) | Intercept, transform or suppress messages globally. |