Skip to content

Utility method for converting expressions into case patterns #59595

@FMorschel

Description

@FMorschel

Inside analyais_server_plugin\lib\edit\correction_utils.dart we have CorrectionUtils.invertCondition for doing what the name suggests. It takes an expression and returns another with the exact opposite result.

For #45831, I was thinking maybe we could have something similar for converting expressions with one constant side into case patterns.

Also one for converting back, from a case pattern into an expression. These could also be exposed as assists (all three of them) if we choose to.

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-assistIssues with analysis server assiststype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions