From 5e6d9d6bb57b4b132c617dfc899627e0a57285aa Mon Sep 17 00:00:00 2001 From: Hixie Date: Tue, 21 Jul 2015 15:13:01 -0700 Subject: [PATCH] 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. --- sky/sdk/example/widgets/card_collection.dart | 2 -- sky/sdk/lib/animation/timeline.dart | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sky/sdk/example/widgets/card_collection.dart b/sky/sdk/example/widgets/card_collection.dart index 609993114af..c3b7cb2fadb 100644 --- a/sky/sdk/example/widgets/card_collection.dart +++ b/sky/sdk/example/widgets/card_collection.dart @@ -28,8 +28,6 @@ class CardModel { AnimationPerformance performance; String get label => "Item $value"; 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 { diff --git a/sky/sdk/lib/animation/timeline.dart b/sky/sdk/lib/animation/timeline.dart index 680130d76bc..1ea2039993f 100644 --- a/sky/sdk/lib/animation/timeline.dart +++ b/sky/sdk/lib/animation/timeline.dart @@ -54,11 +54,12 @@ class Timeline { double end: 1.0 }) { assert(!_animation.isAnimating); - + assert(duration > Duration.ZERO); return _animation.start(new TweenSimulation(duration, begin, end)); } Future animateTo(double target, { Duration duration }) { + assert(duration > Duration.ZERO); return _start(duration: duration, begin: value, end: target); }