truncate method

List<T> truncate([
  1. int? length
])

Implementation

List<T> truncate([int? length]) {
  if (length == null) return [...this];
  return [...this.take(length)];
}