Implement `sample`, add `longPoll` to `buffer` (dart-lang/stream_transform#147)
Closes dart-lang/stream_transform#145
Add `longPoll` support to `aggregateSample`. This method is a package
private implementation detail.
- Refactor to named arguments to make changes smoother.
- Add `longPoll` boolean argument and conditional behavior in each
stream callback.
- Add `onEmpty` callback to let the caller decide whether to emit some
default (empty list in the `buffer` case) or not emit at all (in the
`sample` case) for triggers which do no set up a long poll and have
no prior aggregated events.
- Switch `waitingForTrigger` to the inverted condition `activeLongPoll`
since it is a closer match to how the behavior is described in the docs.
Add `longPoll` argument to `buffer` and update the doc to describe the
conditional behavior. Add a section in the docs discussing the end of
stream behavior.
Add a `sample` method which is similar to `buffer`. Cross reference each
method in the docs.
Update the comparison table with Rx. Show that `buffer` is equivalent to
`buffer(longPoll: false)`, that `sample` is `sampel(longPoll: false)`. I
cannot find an equivalent Rx method to the `longPoll: true` behavior.
6 files changed
tree: 8ae3aa15e14b8b3b4844fecd63c11d987d0b73a6
- pkgs/