decodeBool method
Decode a JSON object that is expected to be a boolean. The strings "true" and "false" are also accepted.
Implementation
bool decodeBool(String jsonPath, Object json) {
if (json is bool) {
return json;
} else if (json == 'true') {
return true;
} else if (json == 'false') {
return false;
}
throw mismatch(jsonPath, 'bool', json);
}