From e0f26b44f202b198a4057ea1e39dc07df3cbe1f1 Mon Sep 17 00:00:00 2001 From: Hans Muller Date: Thu, 16 Mar 2017 07:28:47 -0700 Subject: [PATCH] Fixed a typo in AnimationController.repeat() (#8816) --- .../flutter/lib/src/animation/animation_controller.dart | 6 +++--- .../test/animation/animation_controller_test.dart | 9 +++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/flutter/lib/src/animation/animation_controller.dart b/packages/flutter/lib/src/animation/animation_controller.dart index e0965439b1..1c6523b8bf 100644 --- a/packages/flutter/lib/src/animation/animation_controller.dart +++ b/packages/flutter/lib/src/animation/animation_controller.dart @@ -306,10 +306,10 @@ class AnimationController extends Animation max ??= upperBound; period ??= duration; assert(() { - if (duration == null) { + if (period == null) { throw new FlutterError( - 'AnimationController.repeat() called with no explicit Duration and default Duration.\n' - 'Either the "duration" argument to the repeat() method should be provided, or the ' + 'AnimationController.repeat() called without an explicit period and with no default Duration.\n' + 'Either the "period" argument to the repeat() method should be provided, or the ' '"duration" property should be set, either in the constructor or later, before ' 'calling the repeat() function.' ); diff --git a/packages/flutter/test/animation/animation_controller_test.dart b/packages/flutter/test/animation/animation_controller_test.dart index 4ebc2a3949..7c76bef087 100644 --- a/packages/flutter/test/animation/animation_controller_test.dart +++ b/packages/flutter/test/animation/animation_controller_test.dart @@ -277,4 +277,13 @@ void main() { controller.dispose(); expect(controller.dispose, throwsFlutterError); }); + + test('AnimationController repeat() throws if period is not specified', () { + final AnimationController controller = new AnimationController( + vsync: const TestVSync(), + ); + expect((){ controller.repeat(); }, throwsFlutterError); + expect((){ controller.repeat(period: null); }, throwsFlutterError); + }); + }