dedupeConsecutive method
Removes consecutive duplicate elements (keeps first of each run).
Implementation
@useResult
Iterable<T> dedupeConsecutive() sync* {
T? prev;
for (final T element in this) {
if (prev == null || element != prev) {
yield element;
prev = element;
}
}
}