take function

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

Creates a slice of array 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 array, [int n = 1]) {
  return array.take(n).toList();
}