addRowWhere method
Insert value adjacent to rows matching test — after the match by
default, or before it. With firstOnly (default) only the first match is
used; otherwise value is inserted next to every match.
Implementation
void addRowWhere(bool Function(T value) test, T value, {bool after = true, bool firstOnly = true}) {
_structural(() {
final hits = <int>[];
for (var i = 0; i < _all.length; i++) {
if (test(_all[i])) {
hits.add(i);
if (firstOnly) break;
}
}
for (final i in hits.reversed) {
_all.insert(after ? i + 1 : i, value);
}
});
}