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

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

Issue 2707883002: Fix type warning in Result.release. (Closed)
Patch Set: 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 | « CHANGELOG.md ('k') | pubspec.yaml » ('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 'result/capture_transformer.dart'; 7 import 'result/capture_transformer.dart';
8 import 'result/error.dart'; 8 import 'result/error.dart';
9 import 'result/release_transformer.dart'; 9 import 'result/release_transformer.dart';
10 import 'result/value.dart'; 10 import 'result/value.dart';
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 /// Release the result of a captured future. 85 /// Release the result of a captured future.
86 /// 86 ///
87 /// Converts the [Result] value of the given [future] to a value or error 87 /// Converts the [Result] value of the given [future] to a value or error
88 /// completion of the returned future. 88 /// completion of the returned future.
89 /// 89 ///
90 /// If [future] completes with an error, the returned future completes with 90 /// If [future] completes with an error, the returned future completes with
91 /// the same error. 91 /// the same error.
92 static Future<T> release<T>(Future<Result<T>> future) => 92 static Future<T> release<T>(Future<Result<T>> future) =>
93 future.then<Future<T>>((result) => result.asFuture); 93 future.then<T>((result) => result.asFuture);
94 94
95 /// Capture the results of a stream into a stream of [Result] values. 95 /// Capture the results of a stream into a stream of [Result] values.
96 /// 96 ///
97 /// The returned stream will not have any error events. 97 /// The returned stream will not have any error events.
98 /// Errors from the source stream have been converted to [ErrorResult]s. 98 /// Errors from the source stream have been converted to [ErrorResult]s.
99 static Stream<Result<T>> captureStream<T>(Stream<T> source) => 99 static Stream<Result<T>> captureStream<T>(Stream<T> source) =>
100 source.transform(new CaptureStreamTransformer<T>()); 100 source.transform(new CaptureStreamTransformer<T>());
101 101
102 /// Release a stream of [result] values into a stream of the results. 102 /// Release a stream of [result] values into a stream of the results.
103 /// 103 ///
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 void complete(Completer<T> completer); 143 void complete(Completer<T> completer);
144 144
145 /// Add this result to an [EventSink]. 145 /// Add this result to an [EventSink].
146 /// 146 ///
147 /// Calls the sink's `add` or `addError` method as appropriate. 147 /// Calls the sink's `add` or `addError` method as appropriate.
148 void addTo(EventSink<T> sink); 148 void addTo(EventSink<T> sink);
149 149
150 /// Creates a future completed with this result as a value or an error. 150 /// Creates a future completed with this result as a value or an error.
151 Future<T> get asFuture; 151 Future<T> get asFuture;
152 } 152 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698