SiOptions.parse constructor
SiOptions.parse(
- String? text
Reads key=value pairs; unknown keys are ignored.
Implementation
factory SiOptions.parse(String? text) {
if (text == null) return const SiOptions();
var per = PerMode.power;
for (final pair in text.split(',')) {
final kv = pair.split('=');
if (kv.length != 2) continue;
if (kv[0].trim() == 'per-mode') {
per = switch (kv[1].trim()) {
'symbol' => PerMode.symbol,
'fraction' => PerMode.fraction,
_ => PerMode.power,
};
}
}
return SiOptions(perMode: per);
}