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

Unified Diff: lib/src/result/value.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/result.dart ('k') | lib/src/stream_queue.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « lib/src/result/result.dart ('k') | lib/src/stream_queue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698