Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Unified Diff: lib/src/subscription_stream.dart

Issue 1841223002: Fix most strong mode warnings. (Closed) Base URL: git@github.com:dart-lang/async.git@master
Patch Set: Code review changes Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/stream_zip.dart ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/subscription_stream.dart
diff --git a/lib/src/subscription_stream.dart b/lib/src/subscription_stream.dart
index 4f58c76f8af7dc012c953e6e3e25c89f9147ab42..c448620c5edc6a256aa5e72f50ffc7ad0c555555 100644
--- a/lib/src/subscription_stream.dart
+++ b/lib/src/subscription_stream.dart
@@ -18,7 +18,7 @@ import "delegate/stream_subscription.dart";
/// If other code is accessing the subscription, results may be unpredictable.
class SubscriptionStream<T> extends Stream<T> {
/// The subscription providing the events for this stream.
- StreamSubscription _source;
+ StreamSubscription<T> _source;
/// Create a single-subscription `Stream` from [subscription].
///
@@ -29,7 +29,7 @@ class SubscriptionStream<T> extends Stream<T> {
/// If the `subscription` doesn't send any `done` events, neither will this
/// stream. That may be an issue if `subscription` was made to cancel on
/// an error.
- SubscriptionStream(StreamSubscription subscription)
+ SubscriptionStream(StreamSubscription<T> subscription)
: _source = subscription {
_source.pause();
// Clear callbacks to avoid keeping them alive unnecessarily.
@@ -48,13 +48,10 @@ class SubscriptionStream<T> extends Stream<T> {
cancelOnError = (true == cancelOnError);
var subscription = _source;
_source = null;
- var result;
- if (cancelOnError) {
- result = new _CancelOnErrorSubscriptionWrapper<T>(subscription);
- } else {
- // Wrap the subscription to ensure correct type parameter.
- result = new DelegatingStreamSubscription<T>(subscription);
- }
+
+ var result = cancelOnError
+ ? new _CancelOnErrorSubscriptionWrapper<T>(subscription)
+ : subscription;
result.onData(onData);
result.onError(onError);
result.onDone(onDone);
« no previous file with comments | « lib/src/stream_zip.dart ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698