decodeSize static method
Decodes the given value
to a Size. This expects the
value
to have the following structure:
{
"height": "<double>",
"width": "<double>"
}
Implementation
static Size? decodeSize(
dynamic value, {
bool validate = true,
}) {
Size? result;
if (value is Size) {
result = value;
} else if (value != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/size',
value: value,
validate: validate,
));
result = Size(
JsonClass.maybeParseDouble(value['width'])!,
JsonClass.maybeParseDouble(value['height'])!,
);
}
return result;
}