Fix mounted checks (#137778)

Fixes in preparation for https://dart-review.googlesource.com/c/sdk/+/330561.

The change referenced above tightens the `use_build_context_synchronously` to ensure that `mounted` is checked on the appropriate `BuildContext` or `State`. This change fixes up the flutter/flutter in preparation of this new enforcement.
This commit is contained in:
Michael Goderbauer
2023-11-02 11:21:55 -07:00
committed by GitHub
parent f15f2313b9
commit b09c70a913
3 changed files with 7 additions and 7 deletions

View File

@@ -80,7 +80,7 @@ class _TabbedComponentDemoScaffoldState extends State<TabbedComponentDemoScaffol
final Uri uri = Uri.parse(url);
if (await canLaunchUrl(uri)) {
await launchUrl(uri);
} else if (mounted) {
} else if (context.mounted) {
showDialog<void>(
context: context,
builder: (BuildContext context) {