splice function

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

Arrays

Implementation

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