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

Side by Side Diff: lib/src/stream_sink_completer.dart

Issue 2660333005: Change generic comment syntax to real generic syntax. (Closed)
Patch Set: Update version. Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « lib/src/stream_queue.dart ('k') | lib/src/stream_sink_transformer.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'null_stream_sink.dart'; 7 import 'null_stream_sink.dart';
8 8
9 /// A [sink] where the destination is provided later. 9 /// A [sink] where the destination is provided later.
10 /// 10 ///
(...skipping 18 matching lines...) Expand all
29 /// Returns [sink] typed as a [_CompleterSink]. 29 /// Returns [sink] typed as a [_CompleterSink].
30 _CompleterSink<T> get _sink => sink; 30 _CompleterSink<T> get _sink => sink;
31 31
32 /// Convert a `Future<StreamSink>` to a `StreamSink`. 32 /// Convert a `Future<StreamSink>` to a `StreamSink`.
33 /// 33 ///
34 /// This creates a sink using a sink completer, and sets the destination sink 34 /// This creates a sink using a sink completer, and sets the destination sink
35 /// to the result of the future when the future completes. 35 /// to the result of the future when the future completes.
36 /// 36 ///
37 /// If the future completes with an error, the returned sink will instead 37 /// If the future completes with an error, the returned sink will instead
38 /// be closed. Its [Sink.done] future will contain the error. 38 /// be closed. Its [Sink.done] future will contain the error.
39 static StreamSink/*<T>*/ fromFuture/*<T>*/( 39 static StreamSink<T> fromFuture<T>(
40 Future<StreamSink/*<T>*/> sinkFuture) { 40 Future<StreamSink<T>> sinkFuture) {
41 var completer = new StreamSinkCompleter/*<T>*/(); 41 var completer = new StreamSinkCompleter<T>();
42 sinkFuture.then(completer.setDestinationSink, 42 sinkFuture.then(completer.setDestinationSink,
43 onError: completer.setError); 43 onError: completer.setError);
44 return completer.sink; 44 return completer.sink;
45 } 45 }
46 46
47 /// Sets a sink as the destination for events from the [StreamSinkCompleter]'s 47 /// Sets a sink as the destination for events from the [StreamSinkCompleter]'s
48 /// [sink]. 48 /// [sink].
49 /// 49 ///
50 /// The completer's [sink] will act exactly as [destinationSink]. 50 /// The completer's [sink] will act exactly as [destinationSink].
51 /// 51 ///
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 .catchError((_) {}); 170 .catchError((_) {});
171 } 171 }
172 172
173 // If the user has already asked when the sink is done, connect the sink's 173 // If the user has already asked when the sink is done, connect the sink's
174 // done callback to that completer. 174 // done callback to that completer.
175 if (_doneCompleter != null) { 175 if (_doneCompleter != null) {
176 _doneCompleter.complete(sink.done); 176 _doneCompleter.complete(sink.done);
177 } 177 }
178 } 178 }
179 } 179 }
OLDNEW
« no previous file with comments | « lib/src/stream_queue.dart ('k') | lib/src/stream_sink_transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698