evaluateBool function
Evaluates expression expecting a boolean result (the common case for a
filter/condition); throws FormatException if it isn't boolean.
Audited: 2026-06-12 11:26 EDT
Implementation
bool evaluateBool(String expression, {Map<String, Object?> variables = const <String, Object?>{}}) {
final Object? value = evaluateExpression(expression, variables: variables);
if (value is bool) {
return value;
}
throw FormatException('expression did not evaluate to a boolean', expression);
}