take function

List take(
  1. List list, {
  2. int n = 1,
})

Implementation

List take(List list, {int n = 1}) {
  try {
    return list.sublist(0, n);
  } catch (e) {
    return [];
  }
}