SA
Size: a a a
SA
SA
☕
☕
SA
V
extension ReplaceWhereExt<E> on List<E> {
void replaceWhere(E item, bool test(int index, E e)) {
for (var i = 0; i < this.length; i++) {
if (test(i, this[i])) {
this[i] = item;
}
}
}
}
void main() {
List<int> a = [1, 2, 3, 4, 5];
a.replaceWhere(10, (_, item) => item >= 3);
print(a);
}
☕
SA
A
☕
SA
V
☕
V