From 98413beb9bdea74f6c405267b1179912af3c645c Mon Sep 17 00:00:00 2001 From: jm2097 Date: Sun, 3 Dec 2023 23:59:27 -0500 Subject: [PATCH] Remove state after disconnect exception --- lib/src/screens/home_screen.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/screens/home_screen.dart b/lib/src/screens/home_screen.dart index 5ac9015..3be8e19 100644 --- a/lib/src/screens/home_screen.dart +++ b/lib/src/screens/home_screen.dart @@ -228,7 +228,6 @@ class _HomeScreenState extends State { } prefs.remove('pairingKey'); - _resetState(); } catch (error) { ScaffoldMessenger.of(context).showSnackBar( @@ -236,6 +235,10 @@ class _HomeScreenState extends State { content: Text(error.toString()), ), ); + + final prefs = await SharedPreferences.getInstance(); + prefs.remove('pairingKey'); + _resetState(); } }