dart

Remove List item or element using its index in Dart

If you know the index of a list element and you want to remove it from the list you can use the removeAt() method of Dart.

void main() {
  List<int> numberList = [10, 20, 30, 40, 50];
  
  numberList.removeAt(2); //Remove value from 3rd position
  print(numberList);
}

.removeAt() method dart

To pop an element from a position using its index you can use the .removeAt() method of Dart. The method will remove the element from a List and returns the removed element. The basic syntax for this method is:

List.removeAt(index);
Was this helpful?