-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P4area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-set-fluttertype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
Describe the issue
Lint error use_build_context_synchronously when it was already checked
To Reproduce
final GlobalKey<NavigatorState> navKey = GlobalKey<NavigatorState>();
Future<void> newPhoto() async {
await Future.delayed(const Duration(seconds: 1));
final context = navKey.currentContext;
if (!(context?.mounted ?? false)) {
return;
}
Navigator.of(context!).pop(); // <- LINT ERROR HERE
}
In an updated repo for this bug: https://github.com/vendelin8/dart-lintbug
Expected behavior
No lint infos, because mounted was already checked previously.
Additional context
dart --version
Dart SDK version: 3.5.4 (stable) (Wed Oct 16 16:18:51 2024 +0000) on "linux_x64"
Metadata
Metadata
Assignees
Labels
P4area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packageIssues with the analyzer's support for the linter packagelinter-set-fluttertype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)