Skip to content

"Convert 'forEach' to a 'for' loop" should consider prefer_final_in_for_each #56876

@FMorschel

Description

@FMorschel

The fix Convert 'forEach' to a 'for' loop (lint avoid_function_literals_in_foreach_calls) should consider prefer_final_in_for_each.

Today:

var list = [];
list.forEach((v) => print(v));    //   <- assist available

Becomes:

var list = [];
for (var v in list) {        // <- lint `prefer_final_in_for_each` on `v`
  print(v);
}

I volunteer to fix this.

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