stride method
Returns an Iterable<E>
which iterates this
using a custom stepSize
and starting from startIndex
.
- If
startIndex
is a valid index then the first element of the iterable will be:this.elementAt(startIndex)
. - The parameter
stepSize
must not be zero.
Implementation
Iterable<E> stride(int stepSize, [int startIndex = 0]) {
if (stepSize == 0) {
_throwError<E>();
}
return stepSize > 0
? _StrideIterable<E>(this, stepSize, startIndex)
: _ReverseStrideIterable(this, stepSize, startIndex);
}