replaceItem method
Replaces a single element of this List with replacement
.
Removes the first object which is equal to needle
,
then inserts replacements
at the former index of needle
.
Implementation
void replaceItem(TValue needle, TValue replacement, [int start = 0]) {
final idx = indexOf(needle, start);
if (idx == -1) {
throw BoostException('Item not found in list.');
}
replaceRange(idx, idx + 1, [replacement]);
}