insertAllWaves method
Adds a list of waves
at the given index
in the list of waves
.
Throws a RangeError if the index
is out of bounds.
List<Wave> waves = [wave1, wave2, wave3];
insertAllWaves(1, [wave4, wave5]); // [wave1, wave4, wave5, wave2, wave3]
Implementation
void insertAllWaves(int index, List<Wave> waves) {
if (index < 0 || index > _waves.length) {
throw RangeError.range(index, 0, _waves.length);
}
_waves.insertAll(index, waves);
}