shallowCopyList<T> function

List<T> shallowCopyList<T>(
  1. List<T> source
)

Returns a new list with the same elements as source. Elements are shared by reference (not deep-copied).

Example:

shallowCopyList([1, 2, 3]); // a new [1, 2, 3]

Audited: 2026-06-12 11:26 EDT

Implementation

List<T> shallowCopyList<T>(List<T> source) => List<T>.of(source);