copyWithItem method

List<T> copyWithItem(
  1. T item, [
  2. bool prepend = false
])

Adds an item to the beginning or end of the iterable

Implementation

List<T> copyWithItem(T item, [bool prepend = false]) {
  return prepend ? [item, ...this] : [...this, item];
}