decodeRangeSliderTickMarkShape static method

RangeSliderTickMarkShape? decodeRangeSliderTickMarkShape(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the given value to a RangeSliderTickMarkShape. This expects a "type" attribute to be one of:

  • round

The structure of the other attributes depends on the "type".

Type: round

{
  "tickMarkRadius": <double>,
  "type": "round"
}

Implementation

static RangeSliderTickMarkShape? decodeRangeSliderTickMarkShape(
  dynamic value, {
  bool validate = true,
}) {
  RangeSliderTickMarkShape? result;
  if (value is RangeSliderTickMarkShape) {
    result = value;
  } else {
    assert(value == null || value['type'] is String);
    _checkSupported(
      'RangeSliderTickMarkShape.type',
      [
        'round',
      ],
      value == null ? null : value['type'],
    );

    if (value != null) {
      assert(SchemaValidator.validate(
        schemaId: '$_baseSchemaUrl/range_slider_tick_mark_shape',
        value: value,
        validate: validate,
      ));
      String? type = value['type'];

      switch (type) {
        case 'round':
          result = RoundRangeSliderTickMarkShape(
            tickMarkRadius: JsonClass.parseDouble(value['tickMarkRadius']),
          );
          break;
      }
    }
  }

  return result;
}