decodePointRendererDecorator<D> static method

PointRendererDecorator<D>? decodePointRendererDecorator<D>(
  1. dynamic map, {
  2. bool validate = true,
})

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

{
  "symbolRenderer": <PointSymbolRenderer>,
  "type": "comparison_points"
}

See also

Implementation

static common.PointRendererDecorator<D>? decodePointRendererDecorator<D>(
  dynamic map, {
  bool validate = true,
}) {
  common.PointRendererDecorator<D>? result;

  if (map is common.PointRendererDecorator<D>) {
    result = map;
  } else if (map != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/point_renderer_decorator',
      value: map,
      validate: validate,
    ));

    final type = map['type'];

    switch (type) {
      case 'comparison_points':
        result = common.ComparisonPointsDecorator(
          symbolRenderer: decodePointSymbolRenderer(map['symbolRenderer']),
        );
        break;

      default:
        throw Exception(
          '[decodePointRendererDecorator]: unknown type: [$type]',
        );
    }
  }

  return result;
}