Timer
A countdown timer. Give it a duration; drive it with TickMsg. Read remaining and finished to react when it hits zero.
Install the package
Every component ships in the single dart_tui package.
$dart pub add dart_tui

var timer = TimerModel(duration: const Duration(minutes: 5));
// Start it, then forward ticks in update():
timer = timer.start();
final (next, cmd) = timer.update(tickMsg);
if (timer.finished) {
// countdown complete
}TimerModel
| Property | Type | Description |
|---|---|---|
| duration | Duration | Total countdown length. |
| elapsed | Duration | Time elapsed so far. |
| running | bool | Whether the timer is currently ticking. |