scan<S> method
Accumulates state across events using seed and accumulate.
countStream.scan(0, (acc, n) => acc + n) // running total
Implementation
Stream<S> scan<S>(S seed, S Function(S acc, T value) accumulate) async* {
var state = seed;
await for (final value in this) {
state = accumulate(state, value);
yield state;
}
}