Search code snippets, questions, articles...

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

.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:

Was this helpful?