decodeRangeSliderValueIndicatorShape static method

RangeSliderValueIndicatorShape? decodeRangeSliderValueIndicatorShape(
  1. dynamic value, {
  2. bool validate = true,
})

Decodes the value to a RangeSliderValueIndicatorShape. Supported values are:

  • paddle
  • rectangular

Implementation

static RangeSliderValueIndicatorShape? decodeRangeSliderValueIndicatorShape(
  dynamic value, {
  bool validate = true,
}) {
  RangeSliderValueIndicatorShape? result;
  if (value is RangeSliderValueIndicatorShape) {
    result = value;
  } else {
    _checkSupported(
      'RangeSliderValueIndicatorShape.type',
      [
        'paddle',
        'rectangular',
      ],
      value,
    );

    if (value != null) {
      assert(SchemaValidator.validate(
        schemaId: '$_baseSchemaUrl/range_slider_value_indicator_shape',
        value: value,
        validate: validate,
      ));
      switch (value) {
        case 'paddle':
          result = PaddleRangeSliderValueIndicatorShape();
          break;

        case 'rectangular':
          result = RectangularRangeSliderValueIndicatorShape();
          break;
      }
    }
  }

  return result;
}