stream_channel
2.1.4, released 2 years ago by tools.dart.dev
An abstraction for two-way communication channels based on the Dart Stream class.
What it does
Exposes the StreamChannel interface representing a two-way communication channel, exposing a Stream for receiving and a StreamSink for sending data. It helps abstract communication logic away from underlying protocols and provides utilities for managing two-way communications.
AI-written summary of version 2.1.4, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to abstract two-way communication protocols away from your core logic.
- You are building or testing systems using WebSocket or Isolate connections.
Skip it when
- You do not need a standardized Stream and StreamSink abstraction for bi-directional communication.
Strengths
- Clean abstraction for two-way communication channels based on standard Dart Streams.
- Includes helpful utilities and transformers for dealing with stream channels.
Weaknesses
- Limited to what is supported by standard Dart Streams and Sinks.
Setup
- Kind
- Pure Dart
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
import 'package:stream_channel/stream_channel.dart';
// Example usage concept from documentation:
// StreamChannel channel = ...;Alternatives
Packages that do the same job and could replace stream_channel.
- isolate_channel
Communication channels for isolates based on Flutter's platform channels.
82Compare - package_signature
Retrieve Android package signature (SHA1/SHA256) in a Flutter app.
66Compare - isolate_handler
Abstraction layer for Dart isolates with inter-isolate communication and plugin support.
49Compare - easy_isolate
Provides a simple abstraction over Dart isolates for running code on background threads.
53Compare
Works with
Packages commonly used together with stream_channel: ones it builds on, ones built on it, and its own family.
- asyncstream_channel depends on itUtility classes and helpers that extend Dart's async library.
- stream_transformSame familyExtension methods adding common stream transform operators
- test_apiBuilt on stream_channelThe user facing API for structuring Dart tests and checking expectations.
- shelfBuilt on stream_channelComposable web server middleware for Dart
- testBuilt on stream_channelA full featured library for writing and running Dart tests across platforms.
- shelf_web_socketBuilt on stream_channelShelf handler that upgrades HTTP to WebSocket and provides a WebSocketChannel per connection.
- web_socket_channelBuilt on stream_channelCross‑platform WebSocket channel wrapper for Dart
- sseBuilt on stream_channelBidirectional Server Sent Events client and server for Dart.