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

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

Issue 1777453002: Modernize the package's style. (Closed) Base URL: git@github.com:dart-lang/async.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
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.lazy_stream;
6
7 import "dart:async"; 5 import "dart:async";
8 6
9 import "stream_completer.dart"; 7 import "stream_completer.dart";
10 8
11 /// A [Stream] wrapper that forwards to another [Stream] that's initialized 9 /// A [Stream] wrapper that forwards to another [Stream] that's initialized
12 /// lazily. 10 /// lazily.
13 /// 11 ///
14 /// This class allows a concrete `Stream` to be created only once it has a 12 /// This class allows a concrete `Stream` to be created only once it has a
15 /// listener. It's useful to wrapping APIs that do expensive computation to 13 /// listener. It's useful to wrapping APIs that do expensive computation to
16 /// produce a `Stream`. 14 /// produce a `Stream`.
(...skipping 25 matching lines...) Expand all
42 var result = callback(); 40 var result = callback();
43 41
44 Stream stream = result is Future 42 Stream stream = result is Future
45 ? StreamCompleter.fromFuture(result) 43 ? StreamCompleter.fromFuture(result)
46 : result; 44 : result;
47 45
48 return stream.listen(onData, 46 return stream.listen(onData,
49 onError: onError, onDone: onDone, cancelOnError: cancelOnError); 47 onError: onError, onDone: onDone, cancelOnError: cancelOnError);
50 } 48 }
51 } 49 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698