prepend<T> function
- T item
Returns a function that prepends item
to the beginning of an ImmutableList.
Example:
final list = ImmutableList<int>([2, 3]);
final prepended = prepend(1)(list);
print(prepended.items); // Outputs: (1, 2, 3)
Implementation
ImmutableList<T> Function(ImmutableList<T>) prepend<T>(T item) =>
(ImmutableList<T> list) => ImmutableList([item, ...list.items]);