of<T> function
- Iterable<
T> items
Creates an ImmutableList from the provided iterable items
.
This function constructs an unmodifiable ImmutableList from a given iterable of items.
Example:
final list = of<int>([1, 2, 3, 4]);
print(list); // Outputs: ImmutableList([1, 2, 3, 4])
@param items An iterable to be converted into an ImmutableList.
@return An ImmutableList containing all the elements of items
.
Implementation
ImmutableList<T> of<T>(Iterable<T> items) =>
ImmutableList<T>(List<T>.unmodifiable(items));