decodeTickSpec<D> static method
Decodes the object from a Map-like dynamic structure. This expects the JSON format to be of the following structure:
{
"label": <String>,
"style": <TextStyleSpec>,
"value": <D>
}
Implementation
static common.TickSpec<D>? decodeTickSpec<D>(
dynamic map, {
bool validate = true,
}) {
common.TickSpec<D>? result;
if (map is common.TickSpec<D>) {
result = map;
} else if (map != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/tick_spec',
value: map,
validate: validate,
));
result = common.TickSpec<D>(
JsonClass.parseValue<D>(map['value']),
label: map['label'],
style: decodeTextStyleSpec(
map['style'],
validate: false,
),
);
}
return result;
}