stream_transform 0.0.19

Utility methods to create StreamTransfomer instances to manipulate Streams.

asyncMapBuffer #

Like asyncMap but events are buffered in a List until previous events have been processed rather than being called for each element individually.

asyncMapSample #

Like asyncMap but events are discarded, keeping only the latest, until previous events have been processed rather than being called for every element.

asyncWhere #

Like where but allows an asynchronous predicate.

audit #

Audit waits for a period of time after receiving a value and then only emits the most recent value.

buffer #

Collects values from a source stream until a trigger stream fires and the collected values are emitted.

combineLatest #

Combine the most recent event from two streams through a callback and emit the result.

combineLatestAll #

Combines the latest events emitted from multiple source streams and yields a list of the values.

debounce, debounceBuffer #

Prevents a source stream from emitting too frequently by dropping or collecting values that occur within a given duration.

concurrentAsyncMap #

Like asyncMap but the convert callback can be called with subsequent values before it has finished for previous values.

followedBy #

Appends the values of a stream after another stream finishes.

merge, mergeAll #

Interleaves events from multiple streams into a single stream.

scan #

Scan is like fold, but instead of producing a single value it yields each intermediate accumulation.

startWith, startWithMany, startWithStream #

Prepend a value, an iterable, or a stream to the beginning of another stream.

switchMap, switchLatest #

Flatten a Stream of Streams into a Stream which forwards values from the most recent Stream

takeUntil #

Let values through until a Future fires.

tap #

Taps into a single-subscriber stream to react to values as they pass, without being a real subscriber.

throttle #

Blocks events for a duration after an event is successfully emitted.

whereType #

Like Iterable.whereType for a stream.

0.0.19 #

  • Add asyncMapSample transform.

0.0.18 #

  • Internal cleanup. Passed "trigger" streams or futures now allow <void> generic type rather than an implicit dynamic>

0.0.17 #

  • Add concrete types to the onError callback in tap.

0.0.16+1 #

  • Remove usage of Set literal which is not available before Dart 2.2.0

0.0.16 #

  • Allow a combine callback to return a FutureOr<T> in scan. There are no behavior changes for synchronous callbacks. Potential breaking change In the unlikely situation where scan was used to produce a Stream<Future> inference may now fail and require explicit generic type arguments.
  • Add combineLatest.
  • Add combineLatestAll.

0.0.15 #

  • Add whereType.

0.0.14+1 #

  • Allow using non-dev Dart 2 SDK.

0.0.14 #

  • asyncWhere will now forward exceptions thrown by the callback through the result Stream.
  • Added concurrentAsyncMap.

0.0.13 #

  • mergeAll now accepts an Iterable<Stream> instead of only List<Stream>.

0.0.12 #

  • Add chainTransformers and map for use cases where StreamTransformer instances are stored as variables or passed to methods other than transform.

0.0.11 #

  • Renamed concat as followedBy to match the naming of Iterable.followedBy. concat is now deprecated.

0.0.10 #

  • Updates to support Dart 2.0 core library changes (wave 2.2). See issue 31847 for details.

0.0.9 #

  • Add asyncMapBuffer.

0.0.8 #

  • Add takeUntil.

0.0.7 #

  • Bug Fix: Streams produced with scan and switchMap now correctly report isBroadcast.
  • Add startWith, startWithMany, and startWithStream.

0.0.6 #

  • Bug Fix: Some transformers did not correctly add data to all listeners on broadcast streams. Fixed for throttle, debounce, asyncWhere and audit.
  • Bug Fix: Only call the tap data callback once per event rather than once per listener.
  • Bug Fix: Allow canceling and re-listening to broadcast streams after a merge transform.
  • 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 StreamControllers for forwarding where possible.

0.0.5 #

  • Bug Fix: Allow compiling switchLatest with Dart2Js.
  • Add asyncWhere: Like where but allows an asynchronous predicate.

0.0.4 #

  • Add scan: fold which returns intermediate values
  • Add throttle: block events for a duration after emitting a value
  • Add audit: emits the last event received after a duration

0.0.3 #

  • Add tap: React to values as they pass without being a subscriber on a stream
  • Add switchMap and switchLatest: Flatten a Stream of Streams into a Stream which forwards values from the most recent Stream

0.0.2 #

  • Add concat: Appends streams in series
  • Add merge and mergeAll: Interleaves streams

0.0.1 #

  • Initial release with the following utilities:
    • buffer: Collects events in a List until a trigger stream fires.
    • debounce, debounceBuffer: Collect or drop events which occur closer in time than a given duration.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  stream_transform: ^0.0.19

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:stream_transform/stream_transform.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Sep 17, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.0
  • pana: 0.12.21


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:stream_transform/stream_transform.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and stream_transform.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
Dev dependencies
pedantic ^1.5.0
test ^1.0.0