sublistSafety method

List<E> sublistSafety(
  1. int start, [
  2. int? end
])

Implementation

List<E> sublistSafety(int start, [int? end]) {
  if (start >= length) return [];

  return end == null || end <= length
      ? sublist(start, end)
      : sublist(start, length);
}