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

Unified Diff: lib/src/result/future.dart

Issue 2996143002: Add methods to Result. Bump version to 2.0 and remove deprecated features. (Closed)
Patch Set: Address comments, run dartfmt on tests too. Created 3 years, 4 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
« no previous file with comments | « lib/src/result/error.dart ('k') | lib/src/result/release_sink.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/result/future.dart
diff --git a/lib/src/result/future.dart b/lib/src/result/future.dart
index 749b101f0678210e1c5316d1cf0b405549741858..ff305460fa9e7adf6baac7f5dbd19a8ff5239f9f 100644
--- a/lib/src/result/future.dart
+++ b/lib/src/result/future.dart
@@ -5,7 +5,7 @@
import 'dart:async';
import '../delegate/future.dart';
-import '../result.dart';
+import 'result.dart';
/// A [Future] wrapper that provides synchronous access to the result of the
/// wrapped [Future] once it's completed.
@@ -19,15 +19,9 @@ class ResultFuture<T> extends DelegatingFuture<T> {
Result<T> get result => _result;
Result<T> _result;
- factory ResultFuture(Future<T> future) {
- ResultFuture<T> resultFuture;
- resultFuture = new ResultFuture._(() async {
- var result = await Result.capture(future);
- resultFuture._result = result;
- return await result.asFuture;
- }());
- return resultFuture;
+ ResultFuture(Future<T> future) : super(future) {
+ Result.capture(future).then((result) {
+ _result = result;
+ });
}
-
- ResultFuture._(Future<T> future) : super(future);
}
« no previous file with comments | « lib/src/result/error.dart ('k') | lib/src/result/release_sink.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698