From 94028feab9ee7d3baf8ba5cdf9d59256b3d6e032 Mon Sep 17 00:00:00 2001 From: vjrj <vjrj@comunes.org> Date: Sun, 5 Mar 2023 16:52:39 +0100 Subject: [PATCH] Fix setState error when not mounted --- lib/ui/screens/first_screen.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/ui/screens/first_screen.dart b/lib/ui/screens/first_screen.dart index c180a36b..4a40c4a5 100644 --- a/lib/ui/screens/first_screen.dart +++ b/lib/ui/screens/first_screen.dart @@ -29,9 +29,11 @@ class _FirstScreenState extends State<FirstScreen> { flushbarPosition: FlushbarPosition.TOP, onStatusChanged: (FlushbarStatus? status) { if (status == FlushbarStatus.DISMISSED) { - setState(() { - _showFlushbar = false; - }); + if (mounted) { + setState(() { + _showFlushbar = false; + }); + } } }, ).show(context); -- GitLab