append<T> function

ImmutableList<T> Function(ImmutableList<T>) append<T>(
  1. T item
)

Returns a function that appends item to the end of an ImmutableList.

Example:

final list = ImmutableList<int>([1, 2]);
final appended = append(3)(list);
print(appended.items);  // Outputs: (1, 2, 3)

Implementation

ImmutableList<T> Function(ImmutableList<T>) append<T>(T item) =>
    (ImmutableList<T> list) => ImmutableList([...list.items, item]);