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

Conversation

jakemac53
Copy link
Contributor

Previously the local sink didn't get its generic type inferred properly and you would get runtime errors on certain operations which are difficult to track down.

pubspec.yaml Outdated
@@ -1,5 +1,5 @@
name: stream_channel
version: 1.6.4
version: 1.6.4+5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lmao, fixing...

CHANGELOG.md Outdated
@@ -1,3 +1,8 @@
## 1.6.4+1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.6.5

The + build numbers are only used for pre-1.0.0 packages where the semantics of each version number are shifted to the right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

var stream = channel.stream.map(_codec.decode);
var sink = new StreamSinkTransformer.fromHandlers(handleData: (data, sink) {
var sink = new StreamSinkTransformer.fromHandlers(
handleData: (Object data, EventSink<String> sink) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style nit: I generally tend to prefer adding type parameters to the function rather than to callbacks being passed in to the function (e.g. new StreamSinkTransformer<Object, String>.fromHandlers(...)). It saves on tokens (you don't have to write EventSink explicitly) and makes it more obvious what the return type is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@jakemac53 jakemac53 merged commit fe4f7c5 into master Apr 16, 2018
@jakemac53 jakemac53 deleted the json-document-transformer-bind branch April 16, 2018 20:54
@jakemac53
Copy link
Contributor Author

@nex3 can you publish a version for me? I don't have rights on this package.

@nex3
Copy link
Collaborator

nex3 commented Apr 16, 2018

Done.

mosuem pushed a commit to dart-lang/tools that referenced this pull request Dec 10, 2024
…-document-transformer-bind

Fix JsonDocumentTransformer.bind for dart 2
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants