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.
IsolateChannelrequires a separate import
package:stream_channel/stream_channel.dartwill now not trigger any platform concerns due to importing
jsonDocumenttop level is still available.
.caston the transformed channel instead.
package:stream_channel/isolate_channel.dart. This will be the required import in the next release.
2.0.0or newer SDK.
<3.0.0, and adjust other dependencies.
Fix a Dart 2 issue with inner stream transformation in
Fix a Dart 2 issue with
JsonDocumentTransformer.bindwhere it created an internal stream channel which didn't get a properly inferred type for its
MultiChannelwhere messages from a remote virtual channel could get dropped if the corresponding local channel wasn't registered quickly enough.
StreamChannel.transform(). This previously inverted the generic parameters, so it only really worked with transformers where both generic types were identical.
Disconnector.disconnect()now returns a future that completes when all the inner
StreamSink.close()futures have completed.
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
StreamChannel.cast(), which soundly coerces the generic type of a
StreamChannelTransformer.typed(), which soundly coerces the generic type
of a transformer.
IsolateChannel slightly more efficient.
MultiChannel follow the stream channel rules.
Disconnector, a transformer that allows the caller to disconnect the transformed channel.
new StreamChannel.withGuarantees(), which creates a channel with extra
wrapping to ensure that it obeys the stream channel guarantees.
StreamChannelController, which can be used to create custom
StreamChannel.changeSink() to support
changing only the stream or only the sink of a channel.
Be more explicit about
JsonDocumentTransformer's error-handling behavior.
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.
Add this to your package's pubspec.yaml file:
dependencies: stream_channel: ^2.0.0
You can install packages from the command line:
$ pub get
$ flutter packages get
Alternatively, your editor might support
pub get or
flutter packages get.
Check the docs for your editor to learn more.
Now in your Dart code, you can use:
|2.0.0||Mar 28, 2019|
|1.7.0||Mar 26, 2019|
|1.6.8||Jul 18, 2018|
|1.6.7+1||Jun 12, 2018|
|1.6.7||Jun 8, 2018|
|1.6.6||May 2, 2018|
|1.6.5||Apr 16, 2018|
|1.6.4||Feb 27, 2018|
|1.6.3||Dec 19, 2017|
|1.6.2||Sep 22, 2017|
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]
We analyzed this package on Apr 24, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:
Detected platforms: Flutter, web, other
No platform restriction found in primary library
Maintain an example. (-10 points)
Create a short demo in the
example/ directory to show how to use this package.
Common filename patterns include
stream_channel.dart. Packages with multiple examples should provide
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.