insertAt method

  1. @useResult
List<T> insertAt(
  1. int index,
  2. T value
)

New list with value inserted at index (clamped to 0..length).

Implementation

@useResult
List<T> insertAt(int index, T value) {
  final List<T> out = List<T>.of(this);
  out.insert(index.clamp(0, length), value);
  return out;
}