asList method

List<E> asList()

Returns as an immutable list.

Useful when producing or using APIs that need the List interface. This differs from toList where mutations are explicitly disallowed.

Implementation

List<E> asList() => List<E>.unmodifiable(_list);