decodeArcRendererConfig<D> static method

ArcRendererConfig<D>? decodeArcRendererConfig<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:

{
  "arcLength": <double>,
  "arcRatio": <double>,
  "arcRendererDecorators": <List<ArcLabelDecorator>>,
  "arcWidth": <int>,
  "customRendererId": <String>,
  "layoutPaintOrder": <int>,
  "minHoleWidthForCenterContent": <double>,
  "startAngle": <double>,
  "strokeWidthPx": <double>,
  "symbolRenderer": <SymbolRenderer>
}

See also:

Implementation

static charts.ArcRendererConfig<D>? decodeArcRendererConfig<D>(
  dynamic map, {
  bool validate = true,
}) {
  charts.ArcRendererConfig<D>? result;

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

    result = charts.ArcRendererConfig<D>(
      arcLength: JsonClass.parseDouble(map['arcLength']) ?? (2 * pi),
      arcRatio: JsonClass.parseDouble(map['arcRatio']),
      arcRendererDecorators:
          decodeArcLabelDecoratorList<D>(map['arcRendererDecorators']),
      arcWidth: JsonClass.parseInt(map['arcWidth']),
      customRendererId: map['customRendererId'],
      layoutPaintOrder: JsonClass.parseInt(map['layoutPaintOrder']) ??
          charts.LayoutViewPaintOrder.arc,
      minHoleWidthForCenterContent:
          JsonClass.parseInt(map['minHoleWidthForCenterContent']) ?? 30,
      startAngle: JsonClass.parseDouble(map['startAngle']) ?? -pi / 2,
      strokeWidthPx: JsonClass.parseDouble(map['strokeWidthPx']) ?? 2.0,
      symbolRenderer: decodeSymbolRenderer(
        map['symbolRenderer'],
        validate: false,
      ),
    );
  }

  return result;
}