mapExceptFirst<T> function Null safety

List<T> mapExceptFirst<T>(
  1. Iterable<T>? list,
  2. T map(
    1. T t
    )
)

Implementation

List<T> mapExceptFirst<T>(Iterable<T>? list, T map(T t)) {
  final items = list?.toList(growable: false) ?? [];
  for (var i = 0; i < items.length; ++i) {
    if (i > 0) {
      items[i] = map(items[i]);
    }
  }
  return items;
}