take function

List take(
  1. List list, [
  2. int n = 1
])

Creates a slice of list with n elements taken from the beginning. Uses dart's native List.take(n) method Example

_.take([1, 2, 3], 2);
// Returns [1, 2]

Implementation

List take(List list, [int n = 1]) {
  return list.take(n).toList();
}