Index: lib/src/result/value.dart |
diff --git a/lib/src/result/value.dart b/lib/src/result/value.dart |
index 39fa04818da6e6262452858c78afbc3d8f1421d7..edc41fb4846fe2389019736105626d7b3319373b 100644 |
--- a/lib/src/result/value.dart |
+++ b/lib/src/result/value.dart |
@@ -4,17 +4,18 @@ |
import 'dart:async'; |
-import '../result.dart'; |
+import 'result.dart'; |
import 'error.dart'; |
/// A result representing a returned value. |
class ValueResult<T> implements Result<T> { |
+ /// The result of a successful computation. |
final T value; |
bool get isValue => true; |
bool get isError => false; |
ValueResult<T> get asValue => this; |
- ErrorResult<T> get asError => null; |
+ ErrorResult get asError => null; |
ValueResult(this.value); |
@@ -27,4 +28,9 @@ class ValueResult<T> implements Result<T> { |
} |
Future<T> get asFuture => new Future.value(value); |
+ |
+ int get hashCode => value.hashCode ^ 0x323f1d61; |
+ |
+ bool operator ==(Object other) => |
+ other is ValueResult && value == other.value; |
} |