encodeSliderTrackShape static method

Map<String, dynamic>? encodeSliderTrackShape(
  1. SliderTrackShape? value
)

Encodes the given value to a JSON representation. This only supports encoding the following subclasses:

  • RectangularSliderTrackShape
  • RoundedRectSliderTrackShape

The schema for the rest of the attributes depends on the sub-class.

`RectangularSliderTrackShape``

{
  "type": "rectangular"
}

RoundedRectSliderTrackShape

{
  "type": "round"
}

See also:

Implementation

static Map<String, dynamic>? encodeSliderTrackShape(SliderTrackShape? value) {
  assert(value == null ||
      value is RectangularSliderTrackShape ||
      value is RoundedRectSliderTrackShape);
  Map<String, dynamic>? result;

  if (value != null) {
    if (value is RectangularSliderTrackShape) {
      result = <String, dynamic>{
        'type': 'rectangular',
      };
    } else if (value is RoundedRectSliderTrackShape) {
      result = <String, dynamic>{
        'type': 'rounded',
      };
    }
  }

  return _stripNull(result);
}