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

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: 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
Index: lib/src/result/future.dart
diff --git a/lib/src/result/future.dart b/lib/src/result/future.dart
index 749b101f0678210e1c5316d1cf0b405549741858..6a4cc99d1717af4de38693a1f6b6a5c663efcbbf 100644
--- a/lib/src/result/future.dart
+++ b/lib/src/result/future.dart
@@ -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);
}

Powered by Google App Engine
This is Rietveld 408576698