Chrome Extension

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);
}
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

.removeLast() method in Dart

The above code will pop the last element from the list.

Was this helpful?
0 Comments