replaceLastWhere method

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

Implementation

bool replaceLastWhere(E replacement, bool Function(E item) predicate) {
  if (isEmpty) return false;
  for (int index = length - 1; index >= 0; index--) {
    if (predicate(elementAt(index))) {
      this[index] = replacement;
      return true;
    }
  }
  return false;
}