Fix all strong-mode errors and warnings.
R=sigmund@google.com
Review URL: https://codereview.chromium.org//1966893002 .
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b1b7350..a5a7e46 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.3.2
+
+* Fix all strong-mode errors and warnings.
+
## 1.3.1
* Make `IsolateChannel` slightly more efficient.
diff --git a/lib/src/disconnector.dart b/lib/src/disconnector.dart
index 35ecd1c..beff71d 100644
--- a/lib/src/disconnector.dart
+++ b/lib/src/disconnector.dart
@@ -38,7 +38,7 @@
StreamChannel<T> bind(StreamChannel<T> channel) {
return channel.changeSink((innerSink) {
- var sink = new _DisconnectorSink(innerSink);
+ var sink = new _DisconnectorSink<T>(innerSink);
if (_isDisconnected) {
sink._disconnect();
diff --git a/lib/src/isolate_channel.dart b/lib/src/isolate_channel.dart
index dcb52cb..c725fef 100644
--- a/lib/src/isolate_channel.dart
+++ b/lib/src/isolate_channel.dart
@@ -44,7 +44,7 @@
// value to be an [IsolateChannel].
var streamCompleter = new StreamCompleter<T>();
var sinkCompleter = new StreamSinkCompleter<T>();
- var channel = new IsolateChannel._(
+ var channel = new IsolateChannel<T>._(
streamCompleter.stream, sinkCompleter.sink);
// The first message across the ReceivePort should be a SendPort pointing to
@@ -53,10 +53,11 @@
var subscription;
subscription = receivePort.listen((message) {
if (message is SendPort) {
- var controller = new StreamChannelController(
+ var controller = new StreamChannelController<T>(
allowForeignErrors: false, sync: true);
- new SubscriptionStream<T>(subscription).pipe(controller.local.sink);
- controller.local.stream.listen(message.send,
+ new SubscriptionStream(subscription).pipe(controller.local.sink);
+ controller.local.stream.listen(
+ (data) => message.send(data),
onDone: receivePort.close);
streamCompleter.setSourceStream(controller.foreign.stream);
@@ -92,10 +93,12 @@
/// Creates a stream channel that receives messages from [receivePort] and
/// sends them over [sendPort].
factory IsolateChannel(ReceivePort receivePort, SendPort sendPort) {
- var controller = new StreamChannelController(
+ var controller = new StreamChannelController<T>(
allowForeignErrors: false, sync: true);
receivePort.pipe(controller.local.sink);
- controller.local.stream.listen(sendPort.send, onDone: receivePort.close);
+ controller.local.stream.listen(
+ (data) => sendPort.send(data),
+ onDone: receivePort.close);
return new IsolateChannel._(
controller.foreign.stream, controller.foreign.sink);
}
diff --git a/lib/src/json_document_transformer.dart b/lib/src/json_document_transformer.dart
index 19b2e08..c62c597 100644
--- a/lib/src/json_document_transformer.dart
+++ b/lib/src/json_document_transformer.dart
@@ -22,7 +22,7 @@
/// [FormatException]. If an unencodable object is added to the sink, it
/// synchronously throws a [JsonUnsupportedObjectError].
class JsonDocumentTransformer
- implements StreamChannelTransformer<String, Object> {
+ implements StreamChannelTransformer<Object, String> {
/// The underlying codec that implements the encoding and decoding logic.
final JsonCodec _codec;
diff --git a/lib/src/stream_channel_transformer.dart b/lib/src/stream_channel_transformer.dart
index be032c6..ac98085 100644
--- a/lib/src/stream_channel_transformer.dart
+++ b/lib/src/stream_channel_transformer.dart
@@ -19,10 +19,10 @@
/// Transformers must be able to have `bind` called multiple times.
class StreamChannelTransformer<S, T> {
/// The transformer to use on the channel's stream.
- final StreamTransformer _streamTransformer;
+ final StreamTransformer<T, S> _streamTransformer;
/// The transformer to use on the channel's sink.
- final StreamSinkTransformer _sinkTransformer;
+ final StreamSinkTransformer<S, T> _sinkTransformer;
/// Creates a [StreamChannelTransformer] from existing stream and sink
/// transformers.
@@ -35,8 +35,9 @@
/// and all output from its stream is decoded using [Codec.decoder].
StreamChannelTransformer.fromCodec(Codec<S, T> codec)
: this(
- codec.decoder,
- new StreamSinkTransformer.fromStreamTransformer(codec.encoder));
+ typedStreamTransformer(codec.decoder),
+ StreamSinkTransformer.typed(
+ new StreamSinkTransformer.fromStreamTransformer(codec.encoder)));
/// Transforms the events sent to and emitted by [channel].
///
diff --git a/pubspec.yaml b/pubspec.yaml
index c38c167..8410e05 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -6,7 +6,7 @@
environment:
sdk: '>=1.8.0 <2.0.0'
dependencies:
- async: '^1.8.0'
+ async: '^1.11.0'
stack_trace: '^1.0.0'
dev_dependencies:
test: '^0.12.0'