range static method
An array of int in the range [start..end), where start >= end or start <= end. step
must be positive.
Implementation
@pragma("vm:prefer-inline")
static Arr<int> range(int start, int end, {int step = 1}) {
assert(step > 0, "'step' must be positive.");
if (start < end) {
return Arr<int>.generate(((end - start) + step - 1) ~/ step,
(index) => start + (index * step));
} else {
return Arr<int>.generate(((start - end) + step - 1) ~/ step,
(index) => start - (index * step));
}
}