stream_transform: ^2.0.0 copied to clipboard
A collection of utilities to transform and manipulate streams.
- Migrate to null safety.
- Improve tests of
switchMapand improve documentation with links and clarification.
- Add support for emitting the "leading" event in
- Fix a bug in
mergeAllwhich would cause an exception when cancelling a subscription after using the transformer if the original stream(s) returned
nullfrom cancelling their subscriptions.
concurrentAsyncExpandto interleave events emitted by multiple sub streams created by a callback.
- Remove the top level methods and retain the extensions only.
Add extension methods for most transformers. These should be used in place of the current methods. All current implementations are deprecated and will be removed in the next major version bump.
- Migrating typical use: Instead of
- To migrate a usage where a
StreamTransformerinstance is stored or passed see "Getting a StreamTransformer instance" on the README.
- Migrating typical use: Instead of
chainTransformersutilities are no longer useful with the new patterns so they are deprecated without a replacement. If you still have a need for them they can be replicated with
// Replace `map(convert)` StreamTransformer.fromBind((s) => s.map(convert)); // Replace `chainTransformers(first, second)` StreamTransformer.fromBind((s) => s.transform(first).transform(second));
- Internal cleanup. Passed "trigger" streams or futures now allow
<void>generic type rather than an implicit
- Add concrete types to the
- Remove usage of Set literal which is not available before Dart 2.2.0
- Allow a
combinecallback to return a
scan. There are no behavior changes for synchronous callbacks. Potential breaking change In the unlikely situation where
scanwas used to produce a
Stream<Future>inference may now fail and require explicit generic type arguments.
- Allow using non-dev Dart 2 SDK.
asyncWherewill now forward exceptions thrown by the callback through the result Stream.
mergeAllnow accepts an
Iterable<Stream>instead of only
mapfor use cases where
StreamTransformerinstances are stored as variables or passed to methods other than
followedByto match the naming of
concatis now deprecated.
- Bug Fix: Streams produced with
switchMapnow correctly report
- Bug Fix: Some transformers did not correctly add data to all listeners on
broadcast streams. Fixed for
- Bug Fix: Only call the
tapdata callback once per event rather than once per listener.
- Bug Fix: Allow canceling and re-listening to broadcast streams after a
- Bug Fix: Broadcast streams which are buffered using a single-subscription trigger can be canceled and re-listened.
- Bug Fix: Buffer outputs one more value if there is a pending trigger before the trigger closes.
- Bug Fix: Single-subscription streams concatted after broadcast streams are handled correctly.
- Use sync
StreamControllersfor forwarding where possible.
- Bug Fix: Allow compiling switchLatest with Dart2Js.
wherebut allows an asynchronous predicate.
scan: fold which returns intermediate values
throttle: block events for a duration after emitting a value
audit: emits the last event received after a duration
tap: React to values as they pass without being a subscriber on a stream
switchLatest: Flatten a Stream of Streams into a Stream which forwards values from the most recent Stream
concat: Appends streams in series
mergeAll: Interleaves streams
- Initial release with the following utilities:
buffer: Collects events in a
debounceBuffer: Collect or drop events which occur closer in time than a given duration.