Commit 6d304c03 authored by Hixie's avatar Hixie

Remove redundant operator== and hashCode functions in card example.

It turns out that we aren't really using these. The identity logic is sufficient.

Also, add some asserts for a crash I had once but couldn't reproduce, in case that helps catch it next time.
parent 9da399b0
...@@ -28,8 +28,6 @@ class CardModel { ...@@ -28,8 +28,6 @@ class CardModel {
AnimationPerformance performance; AnimationPerformance performance;
String get label => "Item $value"; String get label => "Item $value";
String get key => value.toString(); String get key => value.toString();
bool operator ==(other) => other is CardModel && other.value == value;
int get hashCode => 373 * 37 * value.hashCode;
} }
class ShrinkingCard extends AnimatedComponent { class ShrinkingCard extends AnimatedComponent {
......
...@@ -54,11 +54,12 @@ class Timeline { ...@@ -54,11 +54,12 @@ class Timeline {
double end: 1.0 double end: 1.0
}) { }) {
assert(!_animation.isAnimating); assert(!_animation.isAnimating);
assert(duration > Duration.ZERO);
return _animation.start(new TweenSimulation(duration, begin, end)); return _animation.start(new TweenSimulation(duration, begin, end));
} }
Future animateTo(double target, { Duration duration }) { Future animateTo(double target, { Duration duration }) {
assert(duration > Duration.ZERO);
return _start(duration: duration, begin: value, end: target); return _start(duration: duration, begin: value, end: target);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment