description

# List<E>.unmodifiableOf constructor

1. @Since.new("3.13")

List<E>.unmodifiableOf(

1. Iterable<E> elements

)

Creates an unmodifiable list containing all `elements`.

The Iterator of `elements` provides the order of the elements.

An unmodifiable list cannot have its length or elements changed. If the elements are themselves immutable, then the resulting list is also immutable.

    final numbers = <int>[1, 2, 3];
    final unmodifiableList = List.unmodifiable(numbers); // [1, 2, 3]
    unmodifiableList[1] = 87; // Throws.

## Implementation

    @Since("3.13")
    factory List.unmodifiableOf(Iterable<E> elements) = List<E>.unmodifiable;