parseSemanticVerdict function
Parses a boolean verdict from raw, rejecting numeric values and arbitrary strings.
Implementation
bool parseSemanticVerdict(Object? raw) {
if (raw is bool) {
return raw;
}
if (raw is String) {
final String lowered = raw.trim().toLowerCase();
if (lowered == 'true' || lowered == 'yes') {
return true;
}
if (lowered == 'false' || lowered == 'no') {
return false;
}
}
throw FormatException('Invalid `matched` value in judgement: $raw.');
}