MultiSlider constructor Null safety

MultiSlider(
  1. {required List<double> values,
  2. required ValueChanged<List<double>>? onChanged,
  3. double max = 1,
  4. double min = 0,
  5. ValueChanged<List<double>>? onChangeStart,
  6. ValueChanged<List<double>>? onChangeEnd,
  7. Color? color,
  8. double horizontalPadding = 26.0,
  9. double height = 45,
  10. int? divisions,
  11. ValueRangePainterCallback? valueRangePainterCallback,
  12. Key? key}
)

Implementation

MultiSlider({
  required this.values,
  required this.onChanged,
  this.max = 1,
  this.min = 0,
  this.onChangeStart,
  this.onChangeEnd,
  this.color,
  this.horizontalPadding = 26.0,
  this.height = 45,
  this.divisions,
  this.valueRangePainterCallback,
  Key? key,
})  : assert(divisions == null || divisions > 0),
      assert(max - min >= 0),
      range = max - min,
      super(key: key) {
  final valuesCopy = [...values]..sort();

  for (int index = 0; index < valuesCopy.length; index++) {
    assert(
      valuesCopy[index] == values[index],
      'MultiSlider: values must be in ascending order!',
    );
  }
  assert(
    values.first >= min && values.last <= max,
    'MultiSlider: At least one value is outside of min/max boundaries!',
  );
}