fromDynamic static method

JsonIconBuilder? fromDynamic(
  1. dynamic map, {
  2. JsonWidgetRegistry? registry,
})

Builds the builder from a Map-like dynamic structure. This expects the JSON format to be of the following structure:

{
  "color": <Color>,
  "icon": <IconData>,
  "semanticLabel": <String>,
  "size": <double>,
  "textDirection": <TextDirection>
}

See also:

  • ThemeDecoder.decodeColor
  • ThemeDecoder.decodeIconData
  • ThemeDecoder.decodeTextDirection

Implementation

static JsonIconBuilder? fromDynamic(
  dynamic map, {
  JsonWidgetRegistry? registry,
}) {
  JsonIconBuilder? result;

  if (map != null) {
    result = JsonIconBuilder(
      color: ThemeDecoder.decodeColor(
        map['color'],
        validate: false,
      ),
      icon: ThemeDecoder.decodeIconData(
        map['icon'],
        validate: false,
      ),
      semanticLabel: map['semanticLabel'],
      size: JsonClass.parseDouble(map['size']),
      textDirection: ThemeDecoder.decodeTextDirection(
        map['textDirection'],
        validate: false,
      ),
    );
  }

  return result;
}