toUnmodifiableList method

  1. @useResult
List<E> toUnmodifiableList()

Transforms this iterable into an unmodifiable List.

This function is non-deterministic when this iterable is unordered, i.e. HashSet.

See toList for creating a modifiable List.

[1, 2, 3].toUnmodifiableList(); //  [1, 2, 3]

Implementation

@useResult List<E> toUnmodifiableList() => List.unmodifiable(this);