fromDynamic static method
Builds the builder from a Map-like dynamic structure. This expects the JSON format to be of the following structure:
{
"color": "<Color>",
"fill": "<double>",
"grade": "<double>",
"icon": "<IconData>",
"opticalSize": "<double>",
"semanticLabel": "<String>",
"shadows": "<List<Shadow>>",
"size": "<double>",
"textDirection": "<TextDirection>",
"weight": "<double>"
}
See also:
ThemeDecoder.decodeColor
ThemeDecoder.decodeIconData
ThemeDecoder.decodeShadow
ThemeDecoder.decodeTextDirection
Implementation
static JsonIconBuilder? fromDynamic(
dynamic map, {
JsonWidgetRegistry? registry,
}) {
JsonIconBuilder? result;
if (map != null) {
result = JsonIconBuilder(
color: ThemeDecoder.decodeColor(
map['color'],
validate: false,
),
fill: JsonClass.maybeParseDouble(map['fill']),
grade: JsonClass.maybeParseDouble(map['grade']),
icon: ThemeDecoder.decodeIconData(
map['icon'],
validate: false,
),
opticalSize: JsonClass.maybeParseDouble(map['opticalSize']),
semanticLabel: map['semanticLabel'],
shadows: JsonClass.maybeFromDynamicList(
map['shadows'],
(map) => ThemeDecoder.decodeShadow(
map,
validate: false,
)!,
),
size: JsonClass.maybeParseDouble(map['size']),
textDirection: ThemeDecoder.decodeTextDirection(
map['textDirection'],
validate: false,
),
);
}
return result;
}