parseTuiSection function
Parses the tui: yaml section. Strict (the repo's ConfigException
conventions): a non-map node, a bad scalar or an unknown key throws —
a typo must never silently skip a section. Absent section → defaults.
Implementation
TuiSectionConfig parseTuiSection(Object? node) {
if (node == null) return const TuiSectionConfig();
if (node is! YamlMap) {
throw ConfigException('tui must be a map, got: $node');
}
_checkStrictKeys(node, 'tui', const {'theme', 'classic', 'statusLine'});
final theme = _tuiThemeName(node['theme']);
final classic = _tuiClassicFlag(node['classic']);
final statusLine = node['statusLine'];
if (statusLine != null && statusLine is! YamlMap) {
throw ConfigException('"tui.statusLine" must be a map, got: $statusLine');
}
return TuiSectionConfig(
theme: theme,
classic: classic,
statusLine: statusLine == null ? null : parseStatusLineConfig(statusLine),
);
}