StepList constructor

StepList(
  1. int start,
  2. int end, [
  3. int? step
])

Implementation

StepList(this.start, this.end, [int? step]) {
  if (step == 0) {
    throw ArgumentError('step: $step');
  }

  final count = end - start;
  if (step == null) {
    if (count > 0) {
      _step = 1;
    } else {
      _step = -1;
    }
  } else {
    _step = step;
  }

  final tempLength = count ~/ _step;
  if (tempLength < 1) {
    _length = 1;
  } else {
    _length = tempLength + 1;
  }
}