decodeIcon static method
Decodes the given value
into an IconData. If the value is null
then
null
will be returned.
{
"color": "<Color>",
"fill": "<double>",
"grade": "<double>",
"icon": "<IconData>",
"opticalSize": "<double>",
"semanticLabel": "<String>",
"shadows": "<List<Shadow>>",
"size": "<double>",
"textDirection": "<TextDirection>",
"weight": "<double>"
}
See also:
Implementation
static Icon? decodeIcon(
dynamic value, {
bool validate = true,
}) {
Icon? result;
if (value is Icon) {
result = value;
} else if (value != null) {
assert(SchemaValidator.validate(
schemaId: '$_baseSchemaUrl/icon',
value: value,
validate: validate,
));
result = Icon(
decodeIconData(value['icon'], validate: false)!,
color: ThemeDecoder.decodeColor(
value['color'],
validate: false,
),
fill: JsonClass.maybeParseDouble(value['fill']),
grade: JsonClass.maybeParseDouble(value['grade']),
opticalSize: JsonClass.maybeParseDouble(value['opticalSize']),
semanticLabel: value['semanticLabel'],
shadows: JsonClass.maybeFromDynamicList(
value['shadows'],
(map) => ThemeDecoder.decodeShadow(
map,
validate: false,
)!,
),
size: JsonClass.maybeParseDouble(value['size']),
textDirection: ThemeDecoder.decodeTextDirection(
value['textDirection'],
validate: false,
),
weight: JsonClass.maybeParseDouble(value['weight']),
);
}
return result;
}