replaceWhere method

void replaceWhere(
  1. bool where(
    1. T
    ),
  2. T newData, {
  3. int? count,
})

Replaces all items that matches where with newData

Implementation

void replaceWhere(bool Function(T) where, T newData, {int? count}) {
  final replaceCount = count ?? length;
  var currentReplaceCount = 0;
  for (var i = 0; i < length; ++i) {
    if (where(this[i])) {
      this[i] = newData;
      ++currentReplaceCount;
    }
    if (currentReplaceCount >= replaceCount) break;
  }
}