decodeTextHeightBehavior static method
Decodes the given value
into a TextHeightBehavior. If the value is
null
then null
will be returned. Otherwise, this expects a Map like
value that in JSON would look like:
{
"applyHeightToFirstAscent": <bool>,
"applyHeightToLastDescent": <bool>
}
Implementation
static TextHeightBehavior? decodeTextHeightBehavior(
dynamic value, {
bool validate = true,
}) {
TextHeightBehavior? result;
if (value is TextHeightBehavior) {
result = value;
} else if (value != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/text_height_behavior',
value: value,
validate: validate,
));
result = TextHeightBehavior(
applyHeightToFirstAscent: value['applyHeightToFirstAscent'] == null
? true
: JsonClass.parseBool(value['applyHeightToLastDescent']),
applyHeightToLastDescent: value['applyHeightToLastDescent'] == null
? true
: JsonClass.parseBool(value['applyHeightToLastDescent']),
);
}
return result;
}