Skip to content

prefer_spread_collections trigger on .toIterable() #59540

Open
@FMorschel

Description

@FMorschel

Describe the issue
The current description or prefer_spread_collections:

Collection literals are excellent when you want to create a new collection out of individual items. But, when existing items are already stored in another collection, spread collection syntax leads to simpler code.

I'd like to bring focus to the end:

... spread collection syntax leads to simpler code.

So I'd like to propose for it to trigger on methods like toSet and toList.

To Reproduce

final list = <int>[];
final set = list.toSet(); // <-- no-trigger

Expected behavior

For it to trigger prefer_spread_collections in the second line.

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-recommendedtype-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