skillToggleValue function

bool skillToggleValue(
  1. String name,
  2. Object? value
)

Coerces one skills: per-skill entry value into an on/off wish. Accepts booleans and the on/off/true/false strings — YAML 1.2 parses bare on/off as strings, and skills: {create-goal: off} is the documented shape (issue #1151). Anything else throws ConfigException naming the skill.

Implementation

bool skillToggleValue(String name, Object? value) {
  if (value is bool) return value;
  switch ('$value'.trim().toLowerCase()) {
    case 'on' || 'true':
      return true;
    case 'off' || 'false':
      return false;
    default:
      throw ConfigException(
        'skills.$name must be on/off (or a boolean), got: $value',
      );
  }
}