diff --git a/lib/src/rotate.dart b/lib/src/rotate.dart index 7a8d5fe..2f74b53 100644 --- a/lib/src/rotate.dart +++ b/lib/src/rotate.dart @@ -142,6 +142,7 @@ class _RotatingTextState extends State @override void dispose() { + _timer?.cancel(); _controller?.stop(); _controller?.dispose(); super.dispose(); @@ -268,6 +269,7 @@ class _RotatingTextState extends State void _animationEndCallback(state) { if (state == AnimationStatus.completed) { + assert(null == _timer || !_timer.isActive); _timer = Timer(_texts[_index]['pause'], _nextAnimation); } } @@ -282,6 +284,7 @@ class _RotatingTextState extends State _setPause(); + assert(null == _timer || !_timer.isActive); _timer = Timer(_texts[_index]['pause'], _nextAnimation); } } diff --git a/lib/src/scale.dart b/lib/src/scale.dart index 288bb20..19eb83a 100644 --- a/lib/src/scale.dart +++ b/lib/src/scale.dart @@ -147,6 +147,7 @@ class _ScaleTextState extends State @override void dispose() { + _timer?.cancel(); _controller?.stop(); _controller?.dispose(); super.dispose(); @@ -255,6 +256,7 @@ class _ScaleTextState extends State void _animationEndCallback(state) { if (state == AnimationStatus.completed) { _isCurrentlyPausing = true; + assert(null == _timer || !_timer.isActive); _timer = Timer(_texts[_index]['pause'], _nextAnimation); } } @@ -274,6 +276,7 @@ class _ScaleTextState extends State _setPause(); + assert(null == _timer || !_timer.isActive); _timer = Timer(Duration(milliseconds: max(pause, left)), _nextAnimation); } diff --git a/lib/src/typer.dart b/lib/src/typer.dart index 979709c..c4469fb 100644 --- a/lib/src/typer.dart +++ b/lib/src/typer.dart @@ -125,6 +125,7 @@ class _TyperState extends State @override void dispose() { + _timer?.cancel(); _controller?.stop(); _controller?.dispose(); super.dispose(); @@ -207,6 +208,7 @@ class _TyperState extends State void _animationEndCallback(state) { if (state == AnimationStatus.completed) { _setPause(); + assert(null == _timer || !_timer.isActive); _timer = Timer(_texts[_index]['pause'], _nextAnimation); } } @@ -227,6 +229,7 @@ class _TyperState extends State _setPause(); + assert(null == _timer || !_timer.isActive); _timer = Timer(Duration(milliseconds: max(pause, left)), _nextAnimation); }