change method

List<E> change(
  1. E value, [
  2. bool test(
    1. E element
    )?
])

Implementation

List<E> change(E value, [bool Function(E element)? test]) {
  final a = use;
  final index = test != null ? a.indexWhere(test) : a.indexOf(value);
  if (index >= 0) {
    a.removeAt(index);
    a.insert(index, value);
    return a;
  }
  return a;
}