Skip to content

Commit

Permalink
Fix implicit casts (#49)
Browse files Browse the repository at this point in the history
- Add some explicit casts.
- Cast a `Stream<dynamic>` to `Stream<List>` since we always expect to
  get a List out.
  • Loading branch information
natebosch authored Jan 14, 2020
1 parent 8ed3d2c commit af36cdd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 2.1.0
## 2.1.0-dev

* Require Dart `2.2.0` or later.

Expand Down
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
include: package:pedantic/analysis_options.yaml
analyzer:
strong-mode:
implicit-casts: false
# These are errors when building in Google
errors:
unused_import: error
Expand Down
6 changes: 3 additions & 3 deletions lib/src/multi_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ class _MultiChannel<T> extends StreamChannelMixin<T>
(message) => _inner.sink.add([0, message]),
onDone: () => _closeChannel(0, 0));

_innerStreamSubscription = _inner.stream.listen((message) {
var id = message[0];
_innerStreamSubscription = _inner.stream.cast<List>().listen((message) {
var id = message[0] as int;

// If the channel was closed before an incoming message was processed,
// ignore that message.
Expand All @@ -156,7 +156,7 @@ class _MultiChannel<T> extends StreamChannelMixin<T>
});

if (message.length > 1) {
controller.local.sink.add(message[1]);
controller.local.sink.add(message[1] as T);
} else {
// A message without data indicates that the channel has been closed. We
// can just close the sink here without doing any more cleanup, because
Expand Down

0 comments on commit af36cdd

Please sign in to comment.