update method
Update a list of items based on a condition.
Implementation
List<T> update(bool Function(T) condition, T Function(T) updater) {
return map((item) {
if (condition(item)) {
return updater(item);
}
return item;
}).toList();
}