decodeSymbolAnnotationRendererConfig<D> static method

SymbolAnnotationRendererConfig<D>? decodeSymbolAnnotationRendererConfig<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:

{
  "customRendererId": <String>,
  "customSymbolRenderers": <Map<String, SymbolRenderer>>,
  "pointRendererDecorators": <List<PointRendererDecorator>>,
  "radiusPx": <double>,
  "showBottomSeparatorLine": <bool>,
  "showSeparatorLines": <bool>,
  "symbolRenderer": <SymbolRenderer>,
  "verticalSymbolBottomPaddingPx": <double>,
  "verticalSymbolTopPaddingPx": <double>
}

See also

Implementation

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

  if (map is common.SymbolAnnotationRendererConfig<D>) {
    result = map;
  } else if (map != null) {
    result = common.SymbolAnnotationRendererConfig<D>(
      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,
                )!,
              ),
            ),
      pointRendererDecorators: map['pointRendererDecorators'],
      radiusPx: JsonClass.parseDouble(map['radiusPx']) ?? 5.0,
      showBottomSeparatorLine: JsonClass.parseBool(
        map['showBottomSeparatorLine'],
      ),
      showSeparatorLines: JsonClass.parseBool(
        map['showSeparatorLines'],
        whenNull: true,
      ),
      symbolRenderer: decodeSymbolRenderer(
        map['symbolRenderer'],
        validate: false,
      ),
      verticalSymbolBottomPaddingPx:
          JsonClass.parseDouble(map['verticalSymbolBottomPaddingPx']) ?? 5.0,
      verticalSymbolTopPaddingPx:
          JsonClass.parseDouble(map['verticalSymbolTopPaddingPx']) ?? 5.0,
    );
  }

  return result;
}