slice<T> function

List<T> slice<T>(
  1. List<T> list,
  2. int begin, [
  3. int? end
])

Implementation

List<T> slice<T>(List<T> list, int begin, [int? end]) => list
    .getRange(
        begin,
        end == null
            ? list.length
            : end < 0
                ? list.length + end
                : end)
    .toList();