From e8195b8f7cc40e6d181c5bd8d077ddd5247ef2f1 Mon Sep 17 00:00:00 2001 From: Simone Sestito Date: Mon, 29 Oct 2018 12:08:43 +0100 Subject: [PATCH] Double check countdown is not disposed before redraw --- lib/route/home/HomeFragment.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/route/home/HomeFragment.dart b/lib/route/home/HomeFragment.dart index 38c8231..9880e00 100644 --- a/lib/route/home/HomeFragment.dart +++ b/lib/route/home/HomeFragment.dart @@ -95,7 +95,7 @@ class CounterState extends State { void _run() async { while (isRunning) { await Future.delayed(const Duration(seconds: 1)); - setState(() {}); + if (isRunning) setState(() {}); } }