replaceFirstWhere method

bool replaceFirstWhere(
  1. E replacement,
  2. bool predicate(
    1. E item
    )
)

Implementation

bool replaceFirstWhere(E replacement, bool Function(E item) predicate) {
  if (isEmpty) return false;
  for (int index = 0; index < length; index++) {
    if (predicate(elementAt(index))) {
      this[index] = replacement;
      return true;
    }
  }
  return false;
}