decodeColor static method
Expects the map
to be either a common.Color
, a Color, or a String
containing the hex value of the color to use.
Implementation
static common.Color? decodeColor(
dynamic map, {
bool validate = true,
}) {
common.Color? result;
if (map is charts.Color) {
result = map;
} else if (map is Color) {
result = fromColor(map);
} else if (map != null) {
assert(SchemaValidator.validate(
schemaId:
'https://peiffer-innovations.github.io/flutter_json_schemas/schemas/json_theme/color',
value: map,
validate: validate,
));
result = fromColor(ThemeDecoder.decodeColor(
map,
validate: false,
)!);
}
return result;
}