copyWithReplacedAll method
Returns a copy with all occurrences of oldItem replaced
Implementation
List<T> copyWithReplacedAll(T oldItem, T newItem) {
return map((e) => e == oldItem ? newItem : e).toList();
}
Returns a copy with all occurrences of oldItem replaced
List<T> copyWithReplacedAll(T oldItem, T newItem) {
return map((e) => e == oldItem ? newItem : e).toList();
}