shallowCopyList<T> function

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

Shallow copy list/map. Roadmap #207. 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]

Implementation

/// Returns a new list with the same elements as [source]. Elements are shared
/// by reference (not deep-copied).
///
/// Example:
/// ```dart
/// shallowCopyList([1, 2, 3]); // a new [1, 2, 3]
/// ```
List<T> shallowCopyList<T>(List<T> source) => List<T>.of(source);