update method
Handles messages by forwarding to children then calling handleUpdate.
Automatically updates theme state when terminal background is detected. Do not override this method. Override handleUpdate instead.
Implementation
@override
(Model, Cmd?) update(Msg msg) {
final cmds = <Cmd>[];
final current = this;
// Auto-detect terminal background and update theme state
if (msg is BackgroundColorMsg) {
updateThemeFromBackground(msg.hex);
}
// Forward to all children
for (final child in current.children) {
final (_, cmd) = child.update(msg);
if (cmd != null) cmds.add(cmd);
}
// Handle own messages
final (newWidget, cmd) = current.handleUpdate(msg);
if (cmd != null) cmds.add(cmd);
return (newWidget, cmds.isEmpty ? null : Cmd.batch(cmds));
}