decodeSlidingViewport<D> static method

SlidingViewport<D>? decodeSlidingViewport<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:

{
  "selectionModelType": <SelectionModelType>
}

See also:

Implementation

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

  if (map is charts.SlidingViewport<D>) {
    result = map;
  } else if (map != null) {
    assert(SchemaValidator.validate(
      schemaId: '$_baseSchemaUrl/sliding_viewport',
      value: map,
      validate: validate,
    ));
    result = charts.SlidingViewport<D>(
      decodeSelectionModelType(
            map['selectionModelType'],
            validate: false,
          ) ??
          common.SelectionModelType.info,
    );
  }

  return result;
}