Skip to content

Commit

Permalink
Make sure context is mounted
Browse files Browse the repository at this point in the history
  • Loading branch information
domesticmouse committed May 29, 2024
1 parent db0765e commit 20c5b80
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions isolate_example/lib/performance_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ class _PerformancePageState extends State<PerformancePage> {
var snackBar = const SnackBar(
content: Text('Main Isolate Done!'),
);
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(snackBar);
});

Expand All @@ -106,6 +107,7 @@ class _PerformancePageState extends State<PerformancePage> {
var snackBar = const SnackBar(
content: Text('Secondary Isolate Done!'),
);
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(snackBar);
});

Expand Down

0 comments on commit 20c5b80

Please sign in to comment.