@@ -51,7 +51,7 @@ class HomePage extends StatefulWidget {
5151 static const routePath = '/home' ;
5252 static const routeName = 'home' ;
5353
54- const HomePage ({Key ? key}) : super ( key: key );
54+ const HomePage ({super . key} );
5555
5656 @override
5757 State <HomePage > createState () => _HomePageState ();
@@ -129,7 +129,9 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
129129 final appDatabase = await sl.getAsync <AppDatabase >();
130130 trackDao = appDatabase.trackDao;
131131 } catch (error) {
132- widgetHelper.showSnackBar (context, 'error: $error ' );
132+ if (mounted) {
133+ widgetHelper.showSnackBar (context, 'error: $error ' );
134+ }
133135 }
134136 setupCronTimer ();
135137 doLoadDataTask ();
@@ -644,15 +646,15 @@ class _HomePageState extends State<HomePage> with TrayListener, WindowListener {
644646 onTap: () async {
645647 final isPermissionScreenRecordingGranted =
646648 await platformChannelHelper.checkPermissionScreenRecording ();
647- if (mounted && isPermissionScreenRecordingGranted != null && ! isPermissionScreenRecordingGranted) {
649+ if (context. mounted && isPermissionScreenRecordingGranted != null && ! isPermissionScreenRecordingGranted) {
648650 widgetHelper.showDialogPermissionScreenRecording (context);
649651 return ;
650652 }
651653
652654 if (isPermissionScreenRecordingGranted! ) {
653655 final isPermissionAccessibilityGranted =
654656 await platformChannelHelper.checkPermissionAccessibility ();
655- if (mounted && isPermissionAccessibilityGranted != null && ! isPermissionAccessibilityGranted) {
657+ if (context. mounted && isPermissionAccessibilityGranted != null && ! isPermissionAccessibilityGranted) {
656658 widgetHelper.showDialogPermissionAccessibility (context);
657659 return ;
658660 }
0 commit comments