Skip to content

Refactoring to convert params/args between positional and named #56280

Closed
@lukehutch

Description

@lukehutch

It would be great if the Dart tooling supported a quick fix that converted functions between positional and named argument types (in either direction).

If the function already has a mix of parameter types, then only the applicable parameters would be converted.

Before:

  Widget _endorsementWidget(
    Profile profile,
    EndorsementView endorsementView,
    bool isOwnProfile,
    bool hideIfApproved,
  ) { ... }

After:

  Widget _endorsementWidget({
    required Profile profile,
    required EndorsementView endorsementView,
    required bool isOwnProfile,
    required bool hideIfApproved,
  }) { ... }

or vice versa.

All invocation site args should also be fixed to correspond to the change in the definition of the function parameters.

(Dart version 3.5.0-180.3.beta)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestdevexp-refactoringIssues with analysis server refactoringslegacy-area-analyzerUse area-devexp instead.type-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