Skip to content

new lint to ensure proper use of BuildContexts (use_build_context_synchronously?) #58215

@pq

Description

@pq

New lint: Do not store BuildContext into variables, or use across async calls.

This lint will flag source where

  • a BuildContext is ever assigned to anything other than a local variable, or

  • a BuildContext is ever passed as an argument to any async function or whose corresponding parameter doesn't have the type BuildContext (where an async method is one that returns either Future or Stream).

Proposed name: do_not_store_build_contexts ?

/cc @jefflim-google @bwilkerson

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions