replaceFirst method

IList<T> replaceFirst({
  1. required T from,
  2. required T to,
})

Finds the first occurrence of from, and replace it with to.

Implementation

IList<T> replaceFirst({required T from, required T to}) {
  var index = indexOf(from);
  return (index == -1) ? this : put(index, to);
}