Skip to content

use_build_context_synchronously false negative when checking mounted for different BuildContext #59565

@AhmedLSayed9

Description

@AhmedLSayed9

Describe the issue
When using multiple BuildContext, use_build_context_synchronously is not triggered if I checked .mounted for a different BuildContext.

To Reproduce

Future<void> f1(BuildContext context, BuildContext anotherContext) async {
  await Future<void>.delayed(Duration.zero);
  // print(context.size);  //this triggers fine
  if (anotherContext.mounted) print(context.size);
}

Expected behavior
The linter should trigger as I've not checked for context.mounted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packagelinter-set-fluttertype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions