OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library async.delegate.stream_subscription; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 | 6 |
9 /// Simple delegating wrapper around a [StreamSubscription]. | 7 /// Simple delegating wrapper around a [StreamSubscription]. |
10 /// | 8 /// |
11 /// Subclasses can override individual methods. | 9 /// Subclasses can override individual methods. |
12 class DelegatingStreamSubscription<T> implements StreamSubscription<T> { | 10 class DelegatingStreamSubscription<T> implements StreamSubscription<T> { |
13 final StreamSubscription _source; | 11 final StreamSubscription _source; |
14 | 12 |
15 /// Create delegating subscription forwarding calls to [sourceSubscription]. | 13 /// Create delegating subscription forwarding calls to [sourceSubscription]. |
16 DelegatingStreamSubscription(StreamSubscription sourceSubscription) | 14 DelegatingStreamSubscription(StreamSubscription sourceSubscription) |
(...skipping 18 matching lines...) Expand all Loading... |
35 void resume() { | 33 void resume() { |
36 _source.resume(); | 34 _source.resume(); |
37 } | 35 } |
38 | 36 |
39 Future cancel() => _source.cancel(); | 37 Future cancel() => _source.cancel(); |
40 | 38 |
41 Future asFuture([futureValue]) => _source.asFuture(futureValue); | 39 Future asFuture([futureValue]) => _source.asFuture(futureValue); |
42 | 40 |
43 bool get isPaused => _source.isPaused; | 41 bool get isPaused => _source.isPaused; |
44 } | 42 } |
OLD | NEW |