copyWithReplace method
Copy current list, replacing all element
occurrences with replacement
.
If element
is not in the list than just copy will be returned.
If current list is null
- returns new empty list.
Implementation
List<E> copyWithReplace(E element, E replacement) {
return this?.copyWithReplace(element, replacement) ?? const [];
}