stream_channel 2.0.0

  • Readme
  • Changelog
  • Installing
  • 94

This package exposes the StreamChannel interface, which represents a two-way communication channel. Each StreamChannel exposes a Stream for receiving data and a StreamSink for sending it.

StreamChannel helps abstract communication logic away from the underlying protocol. For example, the test package re-uses its test suite communication protocol for both WebSocket connections to browser suites and Isolate connections to VM tests.

This package also contains utilities for dealing with StreamChannels and with two-way communications in general. For documentation of these utilities, see the API docs.

2.0.0 #

Breaking changes

  • IsolateChannel requires a separate import package:stram_channel/isolate_channel.dart. package:stream_channel/stream_channel.dart will now not trigger any platform concerns due to importing dart:isolate.
  • Remove JsonDocumentTransformer class. The jsonDocument top level is still available.
  • Remove StreamChannelTransformer.typed. Use .cast on the transformed channel instead.
  • Change Future<dynamic> returns to Future<void>.

1.7.0 #

  • Make IsolateChannel available through package:stream_channel/isolate_channel.dart. This will be the required import in the next release.
  • Require 2.0.0 or newer SDK.
  • Internal style changes.

1.6.8 #

  • Set max SDK version to <3.0.0, and adjust other dependencies.

1.6.7+1 #

  • Fix Dart 2 runtime types in IsolateChannel.

1.6.7 #

  • Update SDK version to 2.0.0-dev.17.0.
  • Add a type argument to MultiChannel.

1.6.6 #

  • Fix a Dart 2 issue with inner stream transformation in GuaranteeChannel.

  • Fix a Dart 2 issue with StreamChannelTransformer.fromCodec().

1.6.5 #

  • Fix an issue with JsonDocumentTransformer.bind where it created an internal stream channel which didn't get a properly inferred type for its sink.

1.6.4 #

  • Fix a race condition in MultiChannel where messages from a remote virtual channel could get dropped if the corresponding local channel wasn't registered quickly enough.

1.6.3 #

  • Use pumpEventQueue() from test.

1.6.2 #

  • Declare support for async 2.0.0.

1.6.1 #

  • Fix the type of StreamChannel.transform(). This previously inverted the generic parameters, so it only really worked with transformers where both generic types were identical.

1.6.0 #

  • Disconnector.disconnect() now returns a future that completes when all the inner StreamSink.close() futures have completed.

1.5.0 #

  • Add new StreamChannel.withCloseGuarantee() to provide the specific guarantee that closing the sink causes the stream to close before it emits any more events. This is the only guarantee that isn't automatically preserved when transforming a channel.

  • StreamChannelTransformers provided by the stream_channel package now properly provide the guarantee that closing the sink causes the stream to close before it emits any more events

1.4.0 #

  • Add StreamChannel.cast(), which soundly coerces the generic type of a channel.

  • Add StreamChannelTransformer.typed(), which soundly coerces the generic type of a transformer.

1.3.2 #

  • Fix all strong-mode errors and warnings.

1.3.1 #

  • Make IsolateChannel slightly more efficient.

  • Make MultiChannel follow the stream channel rules.

1.3.0 #

  • Add Disconnector, a transformer that allows the caller to disconnect the transformed channel.

1.2.0 #

  • Add new StreamChannel.withGuarantees(), which creates a channel with extra wrapping to ensure that it obeys the stream channel guarantees.

  • Add StreamChannelController, which can be used to create custom StreamChannel objects.

1.1.1 #

  • Fix the type annotation for StreamChannel.transform()'s parameter.

1.1.0 #

  • Add StreamChannel.transformStream(), StreamChannel.transformSink(), StreamChannel.changeStream(), and StreamChannel.changeSink() to support changing only the stream or only the sink of a channel.

  • Be more explicit about JsonDocumentTransformer's error-handling behavior.

1.0.1 #

  • Fix MultiChannel's constructor to take a StreamChannel. This is technically a breaking change, but since 1.0.0 was only released an hour ago, we're treating it as a bug fix.

1.0.0 #

  • Initial version

Use this package as a library

1. Depend on it

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


dependencies:
  stream_channel: ^2.0.0

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_channel/stream_channel.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
97
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
94
Learn more about scoring.

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

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:stream_channel/stream_channel.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_channel.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

The package description is too short. (-10 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
async >=1.11.0 <3.0.0 2.4.0
Transitive dependencies
collection 1.14.12
Dev dependencies
test ^1.2.0