shiftElements method
void
shiftElements(
- int start,
- int count,
- int offset
)
Implementation
void shiftElements(int start, int count, int offset) {
if (count < 0) return;
if (start < 0 || start >= _length)
throw Exception('Start argument is out of range');
if (start + offset < 0)
throw Exception('Can not shift elements in list beyond index 0');
if (offset > 0) {
for (var i = count - 1; i >= 0; i--) {
this[start + i + offset] = this[start + i];
}
var expandListBy = (start + count + offset) - _length;
if (expandListBy > 0) {
_length += expandListBy;
while (_length > _array.length) {
length--;
_startIndex++;
}
}
} else {
for (var i = 0; i < count; i++) {
this[start + i + offset] = this[start + i];
}
}
}