Fix implicit casts (#49)
- Add some explicit casts.
- Cast a `Stream<dynamic>` to `Stream<List>` since we always expect to
get a List out.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4f34510..8421292 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-## 2.1.0
+## 2.1.0-dev
* Require Dart `2.2.0` or later.
diff --git a/analysis_options.yaml b/analysis_options.yaml
index df4128a..b36c874 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -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
diff --git a/lib/src/multi_channel.dart b/lib/src/multi_channel.dart
index e0982ae..79f247e 100644
--- a/lib/src/multi_channel.dart
+++ b/lib/src/multi_channel.dart
@@ -140,8 +140,8 @@
(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.
@@ -156,7 +156,7 @@
});
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