diff options
author | Scott Murray <scott.murray@konsulko.com> | 2023-12-21 17:37:57 -0500 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2023-12-21 22:49:02 +0000 |
commit | fcd868bd73d35bd79074f3425317152565aeb275 (patch) | |
tree | 5363cf2b6390cfc3258a62b76c8fd9293e9720a0 /lib/presentation | |
parent | a445ffb0d847b8d1e44213b95bfbe60ecdf19952 (diff) |
Fix late initialization warning
A late initialization warning was being triggered when leaving the
home/dashboard page when the random hybrid animation is disabled.
Initialize the associated timer member as null and add logic to
avoid referencing it in the non-random case where the timer does
not get created.
Bug-AGL: SPEC-5027
Change-Id: I63bd21db3005f70f2fe0d2d34181d0079cd25b00
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'lib/presentation')
-rw-r--r-- | lib/presentation/screens/dashboard/widgets/dashboard_content.dart | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/presentation/screens/dashboard/widgets/dashboard_content.dart b/lib/presentation/screens/dashboard/widgets/dashboard_content.dart index 7e4c469..1d25fdf 100644 --- a/lib/presentation/screens/dashboard/widgets/dashboard_content.dart +++ b/lib/presentation/screens/dashboard/widgets/dashboard_content.dart @@ -15,7 +15,7 @@ class DashBoardState extends ConsumerState<DashBoard> late AnimationController _animationController; late Animation<double> _animation; static bool _isAnimationPlayed = false; - late Timer timer; + Timer? timer = null; @override void initState() { @@ -53,7 +53,8 @@ class DashBoardState extends ConsumerState<DashBoard> @override void dispose() { _animationController.dispose(); - timer.cancel(); + if (timer != null) + timer?.cancel(); super.dispose(); } |