Skip to content

Commit fe4f7c5

Browse files
authored
Merge pull request flutter#18 from dart-lang/json-document-transformer-bind
Fix JsonDocumentTransformer.bind for dart 2
2 parents 1196a6a + 5753cf1 commit fe4f7c5

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.6.5
2+
3+
* Fix an issue with `JsonDocumentTransformer.bind` where it created an internal
4+
stream channel which didn't get a properly inferred type for its `sink`.
5+
16
## 1.6.4
27

38
* Fix a race condition in `MultiChannel` where messages from a remote virtual

lib/src/json_document_transformer.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5+
import 'dart:async';
56
import 'dart:convert';
67

78
import 'package:async/async.dart';
@@ -35,9 +36,10 @@ class JsonDocumentTransformer
3536

3637
JsonDocumentTransformer._(this._codec);
3738

38-
StreamChannel bind(StreamChannel<String> channel) {
39+
StreamChannel<Object> bind(StreamChannel<String> channel) {
3940
var stream = channel.stream.map(_codec.decode);
40-
var sink = new StreamSinkTransformer.fromHandlers(handleData: (data, sink) {
41+
var sink = new StreamSinkTransformer<Object, String>.fromHandlers(
42+
handleData: (data, sink) {
4143
sink.add(_codec.encode(data));
4244
}).bind(channel.sink);
4345
return new StreamChannel.withCloseGuarantee(stream, sink);

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: stream_channel
2-
version: 1.6.4
2+
version: 1.6.5
33
description: An abstraction for two-way communication channels.
44
author: Dart Team <[email protected]>
55
homepage: https://github.com/dart-lang/stream_channel

0 commit comments

Comments
 (0)