splice<T> function

List<T> splice<T>(
  1. List<T> list,
  2. int index, [
  3. num howMany = 0,
  4. dynamic elements,
])

Implementation

List<T> splice<T>(List<T> list, int index,
    [num howMany = 0, /*<T | List<T>>*/ elements]) {
  var endIndex = index + howMany.truncate();
  list.removeRange(index, endIndex >= list.length ? list.length : endIndex);
  if (elements != null) {
    list.insertAll(index, elements is List<T> ? elements : <T>[elements]);
  }
  return list;
}