copyWith method
CircularList<T>
copyWith({
- int? capacity,
- void onElementRemoved(
- T
- void onElementAdded(
- T
Creates a copy of this list with optionally modified parameters.
The new list contains the same elements but can have different:
capacity
onElementRemoved
callbackonElementAdded
callback
Implementation
CircularList<T> copyWith({
int? capacity,
void Function(T)? onElementRemoved,
void Function(T)? onElementAdded,
}) {
final copy = CircularList<T>(
capacity ?? this.capacity,
onElementRemoved: onElementRemoved ?? this.onElementRemoved,
onElementAdded: onElementAdded ?? this.onElementAdded,
);
copy.addAll(toList());
return copy;
}