resizeAndFill method

void resizeAndFill(
  1. int resizeBy,
  2. T fill
)

Resizes the list by resizeBy, setting the new elements to fill if resizeBy is positive, otherwise removing elements if resizeBy is negative.

Implementation

void resizeAndFill(int resizeBy, T fill) {
  if (resizeBy.isNegative) {
    removeFromEnd(-resizeBy);
  } else {
    addAll(List<T>.filled(resizeBy, fill));
  }
}