resize method
- int count,
- T fill
Resizes the vector to contain count elements.
If the current size is greater than count, the container is reduced to its first count elements.
If the current size is less than count, the container is expanded by inserting copies of fill.
Implementation
void resize(int count, T fill) {
if (count < 0) throw ArgumentError('Count cannot be negative');
if (count < _data.length) {
_data.length = count;
} else if (count > _data.length) {
while (_data.length < count) {
_data.add(fill);
}
}
}