Commit e0f26b44 authored by Hans Muller's avatar Hans Muller Committed by GitHub

Fixed a typo in AnimationController.repeat() (#8816)

parent cefcd249
...@@ -306,10 +306,10 @@ class AnimationController extends Animation<double> ...@@ -306,10 +306,10 @@ class AnimationController extends Animation<double>
max ??= upperBound; max ??= upperBound;
period ??= duration; period ??= duration;
assert(() { assert(() {
if (duration == null) { if (period == null) {
throw new FlutterError( throw new FlutterError(
'AnimationController.repeat() called with no explicit Duration and default Duration.\n' 'AnimationController.repeat() called without an explicit period and with no default Duration.\n'
'Either the "duration" argument to the repeat() method should be provided, or the ' '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 ' '"duration" property should be set, either in the constructor or later, before '
'calling the repeat() function.' 'calling the repeat() function.'
); );
......
...@@ -277,4 +277,13 @@ void main() { ...@@ -277,4 +277,13 @@ void main() {
controller.dispose(); controller.dispose();
expect(controller.dispose, throwsFlutterError); 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);
});
} }
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