dart
Dart Program to remove the last element from a List
To remove the last item or element from a list using Dart - you can use the .removeLast() method.
void main() {
List<int> numberList = [1, 2, 3, 4, 5];
numberList.removeLast();
print(numberList);
}
.removeLast() method in Dart
The above code will pop the last element from the list.
Was this helpful?
Similar Posts
- Dart Program to remove multiple items from a List at once
- Dart program to remove duplicate items from a list
- Remove List item or element using its index in Dart
- Dart Program to add Single or Multiple Items to a List
- Dart Program to update or replace List items or values
- Dart program for condition based item removal from a list
- Dart Program to generate unique id using uuid package