From 467181ba75bc917a78769bebeceb56e61c20f50f Mon Sep 17 00:00:00 2001 From: Lukas Klingsbo Date: Fri, 30 Oct 2020 16:17:01 +0100 Subject: [PATCH] Assert message for speed or duration needed --- lib/effects/effects.dart | 5 ++++- lib/effects/move_effect.dart | 5 ++++- lib/effects/rotate_effect.dart | 5 ++++- lib/effects/scale_effect.dart | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/effects/effects.dart b/lib/effects/effects.dart index f3ca9ff3f..ddc3658bb 100644 --- a/lib/effects/effects.dart +++ b/lib/effects/effects.dart @@ -166,7 +166,10 @@ abstract class SimplePositionComponentEffect extends PositionComponentEffect { Curve curve, bool isRelative = false, void Function() onComplete, - }) : assert(duration != null || speed != null), + }) : assert( + duration != null || speed != null, + "Either speed or duration necessary", + ), super( initialIsInfinite, initialIsAlternating, diff --git a/lib/effects/move_effect.dart b/lib/effects/move_effect.dart index 3a65f8a68..0410d9293 100644 --- a/lib/effects/move_effect.dart +++ b/lib/effects/move_effect.dart @@ -33,7 +33,10 @@ class MoveEffect extends SimplePositionComponentEffect { bool isAlternating = false, bool isRelative = false, void Function() onComplete, - }) : assert(duration != null || speed != null), + }) : assert( + duration != null || speed != null, + "Either speed or duration necessary", + ), super( isInfinite, isAlternating, diff --git a/lib/effects/rotate_effect.dart b/lib/effects/rotate_effect.dart index 3a23276ac..1dffa79b4 100644 --- a/lib/effects/rotate_effect.dart +++ b/lib/effects/rotate_effect.dart @@ -17,7 +17,10 @@ class RotateEffect extends SimplePositionComponentEffect { bool isAlternating = false, bool isRelative = false, void Function() onComplete, - }) : assert(duration != null || speed != null), + }) : assert( + duration != null || speed != null, + "Either speed or duration necessary", + ), super( isInfinite, isAlternating, diff --git a/lib/effects/scale_effect.dart b/lib/effects/scale_effect.dart index c7617838c..ec13695c5 100644 --- a/lib/effects/scale_effect.dart +++ b/lib/effects/scale_effect.dart @@ -18,7 +18,10 @@ class ScaleEffect extends SimplePositionComponentEffect { bool isAlternating = false, bool isRelative = false, void Function() onComplete, - }) : assert(duration != null || speed != null), + }) : assert( + duration != null || speed != null, + "Either speed or duration necessary", + ), super( isInfinite, isAlternating,