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

Unified Diff: lib/src/stream_completer.dart

Issue 2660333005: Change generic comment syntax to real generic syntax. (Closed)
Patch Set: Created 3 years, 11 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
Index: lib/src/stream_completer.dart
diff --git a/lib/src/stream_completer.dart b/lib/src/stream_completer.dart
index 953985e387090eba8df812131ee5fac8cac485ac..4311de5216a7fd0faa10d49e2d0789ba557a1600 100644
--- a/lib/src/stream_completer.dart
+++ b/lib/src/stream_completer.dart
@@ -34,10 +34,9 @@ class StreamCompleter<T> {
///
/// If the future completes with an error, the returned stream will
/// instead contain just that error.
- static Stream/*<T>*/ fromFuture/*<T>*/(Future<Stream/*<T>*/> streamFuture) {
- var completer = new StreamCompleter/*<T>*/();
- streamFuture.then(completer.setSourceStream,
- onError: completer.setError);
+ static Stream<T> fromFuture<T>(Future<Stream<T>> streamFuture) {
+ var completer = new StreamCompleter<T>();
+ streamFuture.then(completer.setSourceStream, onError: completer.setError);
return completer.stream;
}
@@ -118,23 +117,21 @@ class _CompleterStream<T> extends Stream<T> {
Stream<T> _sourceStream;
StreamSubscription<T> listen(onData(T data),
- {Function onError,
- void onDone(),
- bool cancelOnError}) {
+ {Function onError, void onDone(), bool cancelOnError}) {
if (_controller == null) {
if (_sourceStream != null && !_sourceStream.isBroadcast) {
// If the source stream is itself single subscription,
// just listen to it directly instead of creating a controller.
- return _sourceStream.listen(onData, onError: onError, onDone: onDone,
- cancelOnError: cancelOnError);
+ return _sourceStream.listen(onData,
+ onError: onError, onDone: onDone, cancelOnError: cancelOnError);
}
_createController();
if (_sourceStream != null) {
_linkStreamToController();
}
}
- return _controller.stream.listen(onData, onError: onError, onDone: onDone,
- cancelOnError: cancelOnError);
+ return _controller.stream.listen(onData,
+ onError: onError, onDone: onDone, cancelOnError: cancelOnError);
}
/// Whether a source stream has been set.
@@ -161,8 +158,9 @@ class _CompleterStream<T> extends Stream<T> {
void _linkStreamToController() {
assert(_controller != null);
assert(_sourceStream != null);
- _controller.addStream(_sourceStream, cancelOnError: false)
- .whenComplete(_controller.close);
+ _controller
+ .addStream(_sourceStream, cancelOnError: false)
+ .whenComplete(_controller.close);
}
/// Sets an empty source stream.
@@ -174,7 +172,7 @@ class _CompleterStream<T> extends Stream<T> {
if (_controller == null) {
_createController();
}
- _sourceStream = _controller.stream; // Mark stream as set.
+ _sourceStream = _controller.stream; // Mark stream as set.
_controller.close();
}

Powered by Google App Engine
This is Rietveld 408576698