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`.
This commit is contained in:
Sam Rawlins 2024-05-08 12:56:22 -07:00 committed by GitHub
parent c97f22ec12
commit 39d8492fb8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -179,7 +179,7 @@ class DialogDemoState extends State<DialogDemo> {
initialTime: _selectedTime!,
)
.then((TimeOfDay? value) {
if (!mounted) {
if (!context.mounted) {
return;
}
if (value != null && value != _selectedTime) {