From 8f1765eef9d25d560ef3a038c4e79fd65b3e74c6 Mon Sep 17 00:00:00 2001 From: Anthony Whitford Date: Sun, 11 Oct 2020 12:54:29 -0700 Subject: [PATCH] Ensured that the timer has been canceled. Resolves #98. --- lib/src/fade.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/src/fade.dart b/lib/src/fade.dart index e7b4d85..f47f023 100644 --- a/lib/src/fade.dart +++ b/lib/src/fade.dart @@ -140,6 +140,7 @@ class _FadeTextState extends State @override void dispose() { + _timer?.cancel(); _controller?.stop(); _controller?.dispose(); super.dispose(); @@ -228,6 +229,7 @@ class _FadeTextState extends State void _animationEndCallback(state) { if (state == AnimationStatus.completed) { _isCurrentlyPausing = true; + assert(null == _timer || !_timer.isActive); _timer = Timer(_texts[_index]['pause'], _nextAnimation); } } @@ -247,6 +249,7 @@ class _FadeTextState extends State _setPause(); + assert(null == _timer || !_timer.isActive); _timer = Timer(Duration(milliseconds: max(pause, left)), _nextAnimation); }