decodeLineStyleSpec static method
Decodes the object from a Map-like dynamic structure. This expects the JSON format to be of the following structure:
{
"color": <Color>,
"dashPattern": <List<int>>,
"thickness": <int>
}
See also
Implementation
static charts.LineStyleSpec? decodeLineStyleSpec(
dynamic map, {
bool validate = true,
}) {
charts.LineStyleSpec? result;
if (result is charts.LineStyleSpec) {
result = map;
} else if (map != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/line_style_spec',
value: map,
validate: validate,
));
result = charts.LineStyleSpec(
color: decodeColor(map['color'], validate: false),
dashPattern: map['dashPattern'] == null
? null
: List<int>.from(
map['dashPattern'].map((e) => JsonClass.parseInt(e)!),
),
thickness: JsonClass.parseInt(map['thickness']),
);
}
return result;
}