dropLast method
All but the last n elements.
Audited: 2026-06-12 11:26 EDT
Implementation
@useResult
List<T> dropLast(int n) {
final List<T> list = toList();
if (n <= 0) return list;
if (n >= list.length) return <T>[];
return list.sublist(0, list.length - n);
}