update method
Updates the component state in response to a message.
Returns the updated component (often this) and an optional command.
Implementation
@override
(CountdownModel, Cmd?) update(Msg msg) {
if (msg is KeyMsg &&
(msg.key.type == KeyType.escape ||
(msg.key.ctrl &&
msg.key.runes.isNotEmpty &&
msg.key.runes.first == 0x63))) {
return (this, Cmd.quit());
}
final (newTimer, cmd) = _timer.update(msg);
_timer = newTimer;
if (_timer.timedOut) {
return (this, Cmd.quit());
}
return (this, cmd);
}