From 39d8492fb8e7e6100e211c51c46f3f97bbb0f201 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Wed, 8 May 2024 12:56:22 -0700 Subject: [PATCH] Tweak to fix context.mounted in dialog_demo (#147998) Prepares for a fix to the `use_build_context_synchronously` lint (https://dart-review.googlesource.com/c/sdk/+/365541) that will complain about these unsafe usages. The lint rule cannot tell that the `mounted` field is shorthand for `context.mounted`. --- .../flutter_gallery/lib/demo/material/dialog_demo.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/integration_tests/flutter_gallery/lib/demo/material/dialog_demo.dart b/dev/integration_tests/flutter_gallery/lib/demo/material/dialog_demo.dart index 764670166c..ee0185f087 100644 --- a/dev/integration_tests/flutter_gallery/lib/demo/material/dialog_demo.dart +++ b/dev/integration_tests/flutter_gallery/lib/demo/material/dialog_demo.dart @@ -179,7 +179,7 @@ class DialogDemoState extends State { initialTime: _selectedTime!, ) .then((TimeOfDay? value) { - if (!mounted) { + if (!context.mounted) { return; } if (value != null && value != _selectedTime) {