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); |
} |