From 107995fcdbe10af87ee02bfd39593e567fa59e77 Mon Sep 17 00:00:00 2001 From: pq Date: Tue, 19 Nov 2024 22:12:43 +0000 Subject: [PATCH] [diagnostics] `use_build_context_synchronously` message fix Picking up abandoned change: https://dart-review.googlesource.com/c/sdk/+/395461 Change-Id: Id5a876dec73870bb379e9ad89226669272ebf673 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/396382 Commit-Queue: Phil Quitslund Reviewed-by: Marya Belanger --- pkg/analyzer/tool/diagnostics/diagnostics.md | 2 +- pkg/linter/messages.yaml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/analyzer/tool/diagnostics/diagnostics.md b/pkg/analyzer/tool/diagnostics/diagnostics.md index 7dcbda9fbca..1c6589fd637 100644 --- a/pkg/analyzer/tool/diagnostics/diagnostics.md +++ b/pkg/analyzer/tool/diagnostics/diagnostics.md @@ -29271,7 +29271,7 @@ The analyzer produces this diagnostic when a `BuildContext` is referenced by a `StatefulWidget` after an asynchronous gap without first checking the `mounted` property. -Storing a `BuildContext` for later use can lead to difficult to diagnose +Storing a `BuildContext` for later use can lead to difficult-to-diagnose crashes. Asynchronous gaps implicitly store a `BuildContext`, making them easy to overlook for diagnosis. diff --git a/pkg/linter/messages.yaml b/pkg/linter/messages.yaml index 7e7b5b8d58f..f398131c91f 100644 --- a/pkg/linter/messages.yaml +++ b/pkg/linter/messages.yaml @@ -13161,7 +13161,7 @@ LintCode: by a `StatefulWidget` after an asynchronous gap without first checking the `mounted` property. - Storing a `BuildContext` for later use can lead to difficult to diagnose + Storing a `BuildContext` for later use can lead to difficult-to-diagnose crashes. Asynchronous gaps implicitly store a `BuildContext`, making them easy to overlook for diagnosis. @@ -13213,7 +13213,7 @@ LintCode: deprecatedDetails: |- **DON'T** use `BuildContext` across asynchronous gaps. - Storing `BuildContext` for later usage can easily lead to difficult to diagnose + Storing `BuildContext` for later usage can easily lead to difficult-to-diagnose crashes. Asynchronous gaps are implicitly storing `BuildContext` and are some of the easiest to overlook when writing code.