Skip to content
This repository was archived by the owner on Feb 10, 2025. It is now read-only.

Fix JsonDocumentTransformer.bind for dart 2 #18

Merged
merged 4 commits into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 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
Expand Down
6 changes: 4 additions & 2 deletions lib/src/json_document_transformer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';
import 'dart:convert';

import 'package:async/async.dart';
Expand Down Expand Up @@ -35,9 +36,10 @@ class JsonDocumentTransformer

JsonDocumentTransformer._(this._codec);

StreamChannel bind(StreamChannel<String> channel) {
StreamChannel<Object> bind(StreamChannel<String> channel) {
var stream = channel.stream.map(_codec.decode);
var sink = new StreamSinkTransformer.fromHandlers(handleData: (data, sink) {
var sink = new StreamSinkTransformer<Object, String>.fromHandlers(
handleData: (data, sink) {
sink.add(_codec.encode(data));
}).bind(channel.sink);
return new StreamChannel.withCloseGuarantee(stream, sink);
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: stream_channel
version: 1.6.4
version: 1.6.5
description: An abstraction for two-way communication channels.
author: Dart Team <[email protected]>
homepage: https://github.com/dart-lang/stream_channel
Expand Down