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?
Similar Posts
- Dart Program to remove the last element from a List
- Dart program for condition based item removal from a list
- Add item at first position of list dart
- Delete item from a List in Flutter [Dart]
- Remove empty lists from a list of lists and flatten it using Dart
- Dart Program to remove multiple items from a List at once
- Dart program to remove duplicate items from a list