takeRight function

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

Implementation

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