decodePointRendererConfig<D> static method

PointRendererConfig<D>? decodePointRendererConfig<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:

{
  "boundsLineRadiusPx": <double>,
  "customRendererId": <String>,
  "customSymbolRenderers": <Map<String, SymbolRenderer>>,
  "layoutPaintOrder": <int>,
  "pointRendererDecorators": <List<PointRendererDecorator>>,
  "radiusPx": <double>,
  "strokeWidthPx": <double>,
  "symbolRenderer": <SymbolRenderer>
}

See also

Implementation

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

  if (map is common.PointRendererConfig<D>) {
    result = map;
  } else if (map != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/point_renderer_config',
      value: map,
      validate: validate,
    ));
    result = common.PointRendererConfig<D>(
      boundsLineRadiusPx: JsonClass.parseDouble(map['boundsLineRadiusPx']),
      customRendererId: map['customRendererId']?.toString(),
      customSymbolRenderers: map['customSymbolRenderers'] == null
          ? null
          : (map['customSymbolRenderers'] as Map).map(
              (key, value) => MapEntry<String, common.SymbolRenderer>(
                key,
                decodeSymbolRenderer(
                  value,
                  validate: false,
                )!,
              ),
            ),
      layoutPaintOrder: JsonClass.parseInt(map['layoutPaintOrder']) ??
          charts.LayoutViewPaintOrder.point,
      pointRendererDecorators: decodePointRendererDecoratorList<D>(
              map['pointRendererDecorators']) ??
          const [],
      radiusPx: JsonClass.parseDouble(map['radiusPx']) ?? 5.0,
      strokeWidthPx: JsonClass.parseDouble(map['strokeWidthPx']) ?? 0.0,
      symbolRenderer: decodeSymbolRenderer(
        map['symbolRenderer'],
        validate: false,
      ),
    );
  }

  return result;
}